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
- ProfileServiceManager.cs
- HtmlControlPersistable.cs
- TextTreeTextBlock.cs
- PersonalizationStateInfo.cs
- DesignerObject.cs
- ViewStateException.cs
- ToolTipAutomationPeer.cs
- ConfigurationPropertyCollection.cs
- ReadOnlyPermissionSet.cs
- MethodCallTranslator.cs
- DeadCharTextComposition.cs
- TemplateColumn.cs
- HtmlElement.cs
- ToolStripLabel.cs
- MarginCollapsingState.cs
- UriExt.cs
- Exceptions.cs
- BaseTemplateCodeDomTreeGenerator.cs
- WebPartUtil.cs
- TraceInternal.cs
- UnmanagedMemoryStream.cs
- Point3DCollectionValueSerializer.cs
- BindingsCollection.cs
- DoubleCollectionConverter.cs
- CaseExpr.cs
- EDesignUtil.cs
- SessionStateModule.cs
- ButtonFlatAdapter.cs
- DynamicResourceExtensionConverter.cs
- PrincipalPermission.cs
- GridView.cs
- CancelEventArgs.cs
- StylusPlugInCollection.cs
- ProcessRequestArgs.cs
- RowTypePropertyElement.cs
- DesignTimeVisibleAttribute.cs
- ContextDataSourceView.cs
- TimeSpanMinutesConverter.cs
- WeakReferenceEnumerator.cs
- ApplicationSecurityInfo.cs
- Point3D.cs
- MediaPlayer.cs
- DataSourceHelper.cs
- NegatedCellConstant.cs
- SecurityPolicyVersion.cs
- CommentAction.cs
- DataGridItemAutomationPeer.cs
- FrameworkElement.cs
- Internal.cs
- TypeBuilder.cs
- listitem.cs
- Light.cs
- ExpressionTable.cs
- TaskResultSetter.cs
- ListViewUpdatedEventArgs.cs
- XPathException.cs
- ToolboxItemLoader.cs
- DataBindingCollection.cs
- SizeFConverter.cs
- Merger.cs
- DesignerAdapterUtil.cs
- UserControlAutomationPeer.cs
- DirectoryInfo.cs
- COM2TypeInfoProcessor.cs
- GlyphRun.cs
- WriteLineDesigner.xaml.cs
- ElementMarkupObject.cs
- XmlMembersMapping.cs
- TypeResolvingOptions.cs
- DataGridViewCheckBoxColumn.cs
- ModuleElement.cs
- URLIdentityPermission.cs
- DrawingAttributeSerializer.cs
- PassportAuthenticationModule.cs
- BypassElement.cs
- InputGestureCollection.cs
- TabPage.cs
- TaskHelper.cs
- BoolExpression.cs
- SingleAnimationBase.cs
- QueryParameter.cs
- XmlNamedNodeMap.cs
- ExpandCollapsePattern.cs
- QueryReaderSettings.cs
- XmlSchemaElement.cs
- BrowserCapabilitiesCodeGenerator.cs
- DrawingServices.cs
- Tablet.cs
- EntityDescriptor.cs
- GifBitmapDecoder.cs
- AttributeXamlType.cs
- HighlightVisual.cs
- UniqueIdentifierService.cs
- Util.cs
- FileSystemInfo.cs
- ParsedAttributeCollection.cs
- SlipBehavior.cs
- BuildProviderAppliesToAttribute.cs
- ListViewItemSelectionChangedEvent.cs
- CapabilitiesSection.cs