Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / xsp / System / Web / Extensions / Script / Services / ProxyGenerator.cs / 1 / ProxyGenerator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { using System; using System.Globalization; using System.Security.Permissions; using System.ServiceModel; using System.Web.Resources; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { if (type == null) { throw new ArgumentNullException("type"); } if (path == null) { throw new ArgumentNullException("path"); } WebServiceData webServiceData = null; ClientProxyGenerator proxyGenerator = null; if (IsWebServiceType(type)) { proxyGenerator = new WebServiceClientProxyGenerator(path, debug); webServiceData = new WebServiceData(type, false); } else if (IsPageType(type)) { proxyGenerator = new PageClientProxyGenerator(path, debug); webServiceData = new WebServiceData(type, true); } else if(IsWCFServiceType(type)){ return WCFServiceClientProxyGenerator.GetClientProxyScript(type, path, debug); } else { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ProxyGenerator_UnsupportedType, type.FullName)); } return proxyGenerator.GetClientProxyScript(webServiceData); } private static bool IsPageType(Type type) { return typeof(System.Web.UI.Page).IsAssignableFrom(type); } private static bool IsWCFServiceType(Type type) { object[] attribs = type.GetCustomAttributes(typeof(ServiceContractAttribute), true); return (attribs.Length != 0); } private static bool IsWebServiceType(Type type) { object[] attribs = type.GetCustomAttributes(typeof(ScriptServiceAttribute), true); return (attribs.Length != 0); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { using System; using System.Globalization; using System.Security.Permissions; using System.ServiceModel; using System.Web.Resources; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { if (type == null) { throw new ArgumentNullException("type"); } if (path == null) { throw new ArgumentNullException("path"); } WebServiceData webServiceData = null; ClientProxyGenerator proxyGenerator = null; if (IsWebServiceType(type)) { proxyGenerator = new WebServiceClientProxyGenerator(path, debug); webServiceData = new WebServiceData(type, false); } else if (IsPageType(type)) { proxyGenerator = new PageClientProxyGenerator(path, debug); webServiceData = new WebServiceData(type, true); } else if(IsWCFServiceType(type)){ return WCFServiceClientProxyGenerator.GetClientProxyScript(type, path, debug); } else { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, AtlasWeb.ProxyGenerator_UnsupportedType, type.FullName)); } return proxyGenerator.GetClientProxyScript(webServiceData); } private static bool IsPageType(Type type) { return typeof(System.Web.UI.Page).IsAssignableFrom(type); } private static bool IsWCFServiceType(Type type) { object[] attribs = type.GetCustomAttributes(typeof(ServiceContractAttribute), true); return (attribs.Length != 0); } private static bool IsWebServiceType(Type type) { object[] attribs = type.GetCustomAttributes(typeof(ScriptServiceAttribute), true); return (attribs.Length != 0); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SettingsSavedEventArgs.cs
- Profiler.cs
- SequenceFullException.cs
- ResourceDisplayNameAttribute.cs
- TextElementCollectionHelper.cs
- SqlAliasesReferenced.cs
- AssertSection.cs
- AudioException.cs
- XhtmlBasicValidatorAdapter.cs
- CacheVirtualItemsEvent.cs
- JpegBitmapDecoder.cs
- DocumentReference.cs
- GridViewColumnCollectionChangedEventArgs.cs
- WebPartConnectVerb.cs
- ZipIOExtraFieldPaddingElement.cs
- SettingsPropertyIsReadOnlyException.cs
- SqlTriggerAttribute.cs
- TableLayoutPanel.cs
- AbstractExpressions.cs
- ImageClickEventArgs.cs
- ExpressionVisitor.cs
- WebPartCollection.cs
- WorkerRequest.cs
- AppDomainUnloadedException.cs
- MatchAllMessageFilter.cs
- Int64KeyFrameCollection.cs
- LinkAreaEditor.cs
- DrawToolTipEventArgs.cs
- DocumentReference.cs
- MenuAutomationPeer.cs
- _AuthenticationState.cs
- PathSegmentCollection.cs
- TableParaClient.cs
- MessageQueuePermissionEntryCollection.cs
- XmlSerializerFactory.cs
- DecoderReplacementFallback.cs
- Switch.cs
- WeakReference.cs
- FixedSOMTableRow.cs
- TextLineResult.cs
- OLEDB_Util.cs
- TypeGeneratedEventArgs.cs
- FontFamily.cs
- RootBrowserWindow.cs
- PointAnimationBase.cs
- ContentIterators.cs
- Grant.cs
- DesignerHelpers.cs
- Application.cs
- QueryCacheManager.cs
- LayoutTableCell.cs
- CuspData.cs
- BitmapCacheBrush.cs
- SqlDataRecord.cs
- VirtualPathProvider.cs
- ListViewGroup.cs
- ImageBrush.cs
- SelectionList.cs
- SplayTreeNode.cs
- Int32KeyFrameCollection.cs
- FilterQuery.cs
- MessageDecoder.cs
- XmlSortKey.cs
- FileLevelControlBuilderAttribute.cs
- ManagementOptions.cs
- ClientSettingsProvider.cs
- ReadOnlyTernaryTree.cs
- ToolStripArrowRenderEventArgs.cs
- QilStrConcat.cs
- ObjectQueryState.cs
- Int64AnimationBase.cs
- AlignmentYValidation.cs
- ForceCopyBuildProvider.cs
- CommonEndpointBehaviorElement.cs
- AspCompat.cs
- XamlParser.cs
- GreaterThanOrEqual.cs
- QueryOperatorEnumerator.cs
- SortedDictionary.cs
- DPAPIProtectedConfigurationProvider.cs
- PersonalizationEntry.cs
- SafeRegistryHandle.cs
- ArrayTypeMismatchException.cs
- SystemColors.cs
- HMACSHA384.cs
- _CookieModule.cs
- TextCharacters.cs
- CanonicalFormWriter.cs
- TextEditorParagraphs.cs
- SchemaReference.cs
- ActivityDesignerLayoutSerializers.cs
- RegexParser.cs
- GeneralTransform.cs
- FieldCollectionEditor.cs
- InertiaRotationBehavior.cs
- ClientSession.cs
- DetailsViewUpdatedEventArgs.cs
- MemberPathMap.cs
- ProgramNode.cs
- PeerContact.cs