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
- EncoderParameter.cs
- MsmqIntegrationValidationBehavior.cs
- SamlAuthorityBinding.cs
- StateDesigner.Layouts.cs
- SafeRegistryKey.cs
- CompilerError.cs
- DataBoundControlHelper.cs
- GenericIdentity.cs
- SendingRequestEventArgs.cs
- Stack.cs
- RowsCopiedEventArgs.cs
- SpellCheck.cs
- ShowExpandedMultiValueConverter.cs
- AnonymousIdentificationSection.cs
- DictionaryBase.cs
- prefixendpointaddressmessagefiltertable.cs
- AnimationClock.cs
- DescendentsWalkerBase.cs
- CompoundFileDeflateTransform.cs
- ContextStaticAttribute.cs
- LogEntryHeaderv1Deserializer.cs
- DictionarySectionHandler.cs
- EntityCommandExecutionException.cs
- ISAPIWorkerRequest.cs
- DoubleCollectionValueSerializer.cs
- WindowsTab.cs
- ReferenceService.cs
- TrackingMemoryStream.cs
- ToolBarTray.cs
- FormViewPagerRow.cs
- DbException.cs
- MdiWindowListItemConverter.cs
- OdbcError.cs
- DataColumnPropertyDescriptor.cs
- FormConverter.cs
- ListDictionary.cs
- AnimationStorage.cs
- GradientStop.cs
- HandlerBase.cs
- NopReturnReader.cs
- NativeMethods.cs
- PreservationFileWriter.cs
- BooleanStorage.cs
- Thickness.cs
- Identity.cs
- ProjectionCamera.cs
- PropertyDescriptor.cs
- ManipulationPivot.cs
- WebPartAuthorizationEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- IsolatedStorage.cs
- WeakReference.cs
- PipelineModuleStepContainer.cs
- LocationUpdates.cs
- WebBrowserPermission.cs
- Models.cs
- HostSecurityManager.cs
- GroupStyle.cs
- ClientScriptManagerWrapper.cs
- DefaultHttpHandler.cs
- CommandCollectionEditor.cs
- DefaultAssemblyResolver.cs
- LinqDataSourceSelectEventArgs.cs
- FormatConvertedBitmap.cs
- SynchronousChannel.cs
- BuildProviderCollection.cs
- UnsafeNativeMethods.cs
- HttpCapabilitiesSectionHandler.cs
- DataList.cs
- ApplicationServiceManager.cs
- HostExecutionContextManager.cs
- PathFigureCollectionValueSerializer.cs
- IsolatedStorage.cs
- DataContract.cs
- XmlTextAttribute.cs
- ProxyHelper.cs
- BaseInfoTable.cs
- XmlUrlResolver.cs
- IERequestCache.cs
- EmbeddedObject.cs
- DataGridColumn.cs
- AsymmetricAlgorithm.cs
- DeferredReference.cs
- FixedSchema.cs
- PropertyMap.cs
- ExpressionWriter.cs
- HttpModulesSection.cs
- FunctionParameter.cs
- TabItemAutomationPeer.cs
- WindowClosedEventArgs.cs
- FormCollection.cs
- QilXmlWriter.cs
- ProtocolInformationWriter.cs
- ReadOnlyHierarchicalDataSource.cs
- TagMapInfo.cs
- CqlGenerator.cs
- UriTemplatePathPartiallyEquivalentSet.cs
- HtmlInputPassword.cs
- OAVariantLib.cs
- TransformValueSerializer.cs