Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Script / Services / ProxyGenerator.cs / 1305376 / ProxyGenerator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { using System; using System.Globalization; using System.ServiceModel; using System.ServiceModel.Description; using System.Web.Resources; public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { return GetClientProxyScript(type, path, debug, null); } public static string GetClientProxyScript(Type type, string path, bool debug, ServiceEndpoint serviceEndpoint) { 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, serviceEndpoint); } 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.ServiceModel; using System.ServiceModel.Description; using System.Web.Resources; public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { return GetClientProxyScript(type, path, debug, null); } public static string GetClientProxyScript(Type type, string path, bool debug, ServiceEndpoint serviceEndpoint) { 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, serviceEndpoint); } 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
- XmlNavigatorFilter.cs
- XmlDataImplementation.cs
- MetabaseReader.cs
- SqlGenerator.cs
- TdsParserHelperClasses.cs
- SchemaComplexType.cs
- _NtlmClient.cs
- FocusManager.cs
- DisplayNameAttribute.cs
- Converter.cs
- GeneralTransformCollection.cs
- StringValidator.cs
- ProfileEventArgs.cs
- BamlRecordReader.cs
- Zone.cs
- SizeConverter.cs
- DesignerRegion.cs
- BufferedGraphicsContext.cs
- BroadcastEventHelper.cs
- BuildProvider.cs
- ListViewItemEventArgs.cs
- TemplateBamlRecordReader.cs
- BaseEntityWrapper.cs
- XmlExtensionFunction.cs
- KeyedCollection.cs
- RightsManagementLicense.cs
- LoopExpression.cs
- Int32CollectionConverter.cs
- BulletedList.cs
- DataGridBeginningEditEventArgs.cs
- CodeMemberMethod.cs
- OleDbEnumerator.cs
- RelationshipNavigation.cs
- processwaithandle.cs
- SimpleType.cs
- ADRole.cs
- EventItfInfo.cs
- MissingSatelliteAssemblyException.cs
- Automation.cs
- TableHeaderCell.cs
- ParameterCollection.cs
- EmbossBitmapEffect.cs
- Focus.cs
- Brush.cs
- PlainXmlDeserializer.cs
- CustomAttribute.cs
- CqlIdentifiers.cs
- ContainerParaClient.cs
- HealthMonitoringSectionHelper.cs
- CrossContextChannel.cs
- PageOrientation.cs
- InheritanceAttribute.cs
- FlowLayoutPanel.cs
- StartUpEventArgs.cs
- Exceptions.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- XmlSchemaObjectTable.cs
- BitmapFrameDecode.cs
- SystemColors.cs
- DataColumnMappingCollection.cs
- StringResourceManager.cs
- HyperLinkDesigner.cs
- XmlDownloadManager.cs
- updateconfighost.cs
- ProtocolsConfigurationEntry.cs
- TextDecorationLocationValidation.cs
- CodeParameterDeclarationExpressionCollection.cs
- QilReplaceVisitor.cs
- XmlArrayItemAttribute.cs
- SizeValueSerializer.cs
- DbConnectionFactory.cs
- FaultFormatter.cs
- Int32Storage.cs
- DataObjectPastingEventArgs.cs
- BitmapImage.cs
- PointLight.cs
- SurrogateEncoder.cs
- RichTextBox.cs
- LogEntryUtils.cs
- HttpRequest.cs
- WebPartHelpVerb.cs
- IPPacketInformation.cs
- XmlSchemaType.cs
- ObjRef.cs
- SharedPersonalizationStateInfo.cs
- DSASignatureFormatter.cs
- CodeDirectoryCompiler.cs
- SQLByteStorage.cs
- Rotation3DKeyFrameCollection.cs
- EventDescriptorCollection.cs
- IteratorFilter.cs
- CompressedStack.cs
- MatrixValueSerializer.cs
- SafeNativeMethods.cs
- InfoCardX509Validator.cs
- AssertHelper.cs
- TransformerConfigurationWizardBase.cs
- DelegatingTypeDescriptionProvider.cs
- TargetException.cs
- XmlSchemaInfo.cs