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
- ProxySimple.cs
- HyperlinkAutomationPeer.cs
- PenLineJoinValidation.cs
- IdleTimeoutMonitor.cs
- QueryPageSettingsEventArgs.cs
- SecurityElement.cs
- METAHEADER.cs
- XamlDesignerSerializationManager.cs
- XmlNamedNodeMap.cs
- SqlDataSource.cs
- Path.cs
- TypeContext.cs
- PageParserFilter.cs
- TreeNodeBindingCollection.cs
- RtfControlWordInfo.cs
- IDispatchConstantAttribute.cs
- ActivityUtilities.cs
- DurableMessageDispatchInspector.cs
- ProjectionPruner.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- RowUpdatedEventArgs.cs
- UnsafeNativeMethods.cs
- XPathEmptyIterator.cs
- GeneralTransform3D.cs
- FormsAuthenticationEventArgs.cs
- VirtualPathUtility.cs
- AutomationIdentifier.cs
- Monitor.cs
- LowerCaseStringConverter.cs
- Object.cs
- MDIWindowDialog.cs
- StructuredTypeInfo.cs
- ServiceObjectContainer.cs
- ReadOnlyDictionary.cs
- Itemizer.cs
- InputLanguageEventArgs.cs
- FormViewUpdateEventArgs.cs
- PolicyLevel.cs
- CustomTypeDescriptor.cs
- DateTimeAutomationPeer.cs
- CompareValidator.cs
- SharedUtils.cs
- SmiEventSink_DeferedProcessing.cs
- DrawingContextWalker.cs
- WebPartPersonalization.cs
- VectorCollectionConverter.cs
- HighlightComponent.cs
- ToolStripManager.cs
- HwndSourceParameters.cs
- ForeignKeyConstraint.cs
- TextFormatterContext.cs
- SoapCodeExporter.cs
- CryptoApi.cs
- MonthChangedEventArgs.cs
- RightNameExpirationInfoPair.cs
- Axis.cs
- DataSetSchema.cs
- ServiceModelEnumValidator.cs
- BlurEffect.cs
- SystemIcons.cs
- GreaterThan.cs
- MasterPage.cs
- LinkLabel.cs
- SafeNativeMethodsOther.cs
- MessageDescription.cs
- ContextProperty.cs
- ControlParameter.cs
- FixedHyperLink.cs
- PartialList.cs
- Dictionary.cs
- InvokeMethodActivity.cs
- RequestCache.cs
- MenuItem.cs
- QueryContext.cs
- RSAProtectedConfigurationProvider.cs
- IntSecurity.cs
- PageTheme.cs
- MediaPlayerState.cs
- TreeNodeBinding.cs
- ImportContext.cs
- DbMetaDataFactory.cs
- CommonDialog.cs
- Package.cs
- ThemeableAttribute.cs
- SoapParser.cs
- RoleGroup.cs
- RunClient.cs
- XXXOnTypeBuilderInstantiation.cs
- Matrix.cs
- _AutoWebProxyScriptWrapper.cs
- NamedPermissionSet.cs
- XPathMultyIterator.cs
- SqlConnectionString.cs
- MetadataArtifactLoaderComposite.cs
- NativeStructs.cs
- DataStreams.cs
- RootBrowserWindowAutomationPeer.cs
- IResourceProvider.cs
- StructuredTypeEmitter.cs
- ObjectComplexPropertyMapping.cs