Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BooleanSwitch.cs
- VisualCollection.cs
- TextEffect.cs
- counter.cs
- Error.cs
- BitmapFrameEncode.cs
- ApplicationInterop.cs
- DefaultObjectMappingItemCollection.cs
- EventManager.cs
- CodeDirectoryCompiler.cs
- FilteredReadOnlyMetadataCollection.cs
- PtsHelper.cs
- ContentType.cs
- DataPagerField.cs
- CursorConverter.cs
- BitmapImage.cs
- SecurityVersion.cs
- EpmAttributeNameBuilder.cs
- EntityUtil.cs
- BamlLocalizationDictionary.cs
- FormatControl.cs
- XmlObjectSerializerContext.cs
- DataBindingValueUIHandler.cs
- CustomExpression.cs
- UnsafeNativeMethods.cs
- PerfCounters.cs
- TemplateColumn.cs
- SchemaTableColumn.cs
- Row.cs
- hwndwrapper.cs
- SingleBodyParameterMessageFormatter.cs
- WindowsIPAddress.cs
- MultiDataTrigger.cs
- EpmSourceTree.cs
- XPathNavigatorKeyComparer.cs
- CustomAttributeSerializer.cs
- XamlBuildProvider.cs
- StringValueSerializer.cs
- SqlMultiplexer.cs
- ClassHandlersStore.cs
- BindingContext.cs
- EntityEntry.cs
- DynamicMethod.cs
- ItemContainerGenerator.cs
- DbConnectionOptions.cs
- LinkedResourceCollection.cs
- NonParentingControl.cs
- ScrollData.cs
- SqlConnectionPoolGroupProviderInfo.cs
- MaskedTextBoxTextEditor.cs
- RNGCryptoServiceProvider.cs
- TreeViewDesigner.cs
- ColumnHeaderCollectionEditor.cs
- FtpWebRequest.cs
- SendMailErrorEventArgs.cs
- SHA384.cs
- TextBoxAutoCompleteSourceConverter.cs
- Encoding.cs
- WebBrowserUriTypeConverter.cs
- LineUtil.cs
- Condition.cs
- NTAccount.cs
- WindowsBrush.cs
- UriTemplateMatchException.cs
- precedingsibling.cs
- ClientWindowsAuthenticationMembershipProvider.cs
- WmlMobileTextWriter.cs
- RectangleGeometry.cs
- PolicyValidator.cs
- WebPartEventArgs.cs
- MD5.cs
- ScrollChrome.cs
- ResolveCompletedEventArgs.cs
- RepeatInfo.cs
- PropertyValueUIItem.cs
- ColumnMapVisitor.cs
- PrintPageEvent.cs
- IDictionary.cs
- DataErrorValidationRule.cs
- pingexception.cs
- TypeDependencyAttribute.cs
- BindingBase.cs
- ControlEvent.cs
- Win32PrintDialog.cs
- MultiPartWriter.cs
- OleDbConnection.cs
- InstallerTypeAttribute.cs
- SQLInt16Storage.cs
- CapiHashAlgorithm.cs
- DescendentsWalker.cs
- EventWaitHandle.cs
- AnnotationMap.cs
- MsmqHostedTransportConfiguration.cs
- FieldAccessException.cs
- DBPropSet.cs
- PropertyDescriptor.cs
- Page.cs
- Calendar.cs
- CachedPathData.cs
- StorageConditionPropertyMapping.cs