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
- MimeTypeAttribute.cs
- AppModelKnownContentFactory.cs
- ToolStripCollectionEditor.cs
- MatrixAnimationUsingPath.cs
- AdRotator.cs
- AuthenticationException.cs
- DataServiceRequestException.cs
- CompiledQuery.cs
- InstalledVoice.cs
- AtlasWeb.Designer.cs
- TemplateManager.cs
- SqlDataSourceFilteringEventArgs.cs
- sqlpipe.cs
- ResXDataNode.cs
- _ChunkParse.cs
- ContentElement.cs
- XmlSchemaAnyAttribute.cs
- UnitControl.cs
- ExtendedProperty.cs
- XmlHierarchicalDataSourceView.cs
- FtpRequestCacheValidator.cs
- DateTimeOffset.cs
- Propagator.Evaluator.cs
- ASCIIEncoding.cs
- EventPropertyMap.cs
- PlatformNotSupportedException.cs
- TextDecorations.cs
- PrefixQName.cs
- SubqueryRules.cs
- ValidationErrorEventArgs.cs
- NativeDirectoryServicesQueryAPIs.cs
- ListViewDataItem.cs
- PointAnimationBase.cs
- MultipleViewPattern.cs
- TileBrush.cs
- WebFaultException.cs
- TimeoutTimer.cs
- Enum.cs
- ForwardPositionQuery.cs
- ContextMenuService.cs
- FileRecordSequenceCompletedAsyncResult.cs
- SelectingProviderEventArgs.cs
- BitmapDownload.cs
- NativeObjectSecurity.cs
- FormsAuthenticationConfiguration.cs
- SqlMethodAttribute.cs
- DataSourceControl.cs
- MatrixKeyFrameCollection.cs
- CachingHintValidation.cs
- CellNormalizer.cs
- EntityParameter.cs
- HttpResponseHeader.cs
- FontCacheLogic.cs
- QueryOperationResponseOfT.cs
- LicenseException.cs
- IntellisenseTextBox.cs
- XmlTypeMapping.cs
- PropertyGrid.cs
- TransformFinalBlockRequest.cs
- ArgumentException.cs
- PlatformCulture.cs
- KeyGestureValueSerializer.cs
- WebPartHeaderCloseVerb.cs
- HtmlTableRowCollection.cs
- Debugger.cs
- ColumnResizeUndoUnit.cs
- TextRangeProviderWrapper.cs
- ClientSponsor.cs
- ImportContext.cs
- SamlConstants.cs
- DataGridHeaderBorder.cs
- WebPartDescription.cs
- DPCustomTypeDescriptor.cs
- MarkupWriter.cs
- System.Data_BID.cs
- InvalidCommandTreeException.cs
- ResourcePermissionBaseEntry.cs
- TrackingServices.cs
- ColumnBinding.cs
- FontNamesConverter.cs
- XPathSingletonIterator.cs
- XmlEncoding.cs
- StringInfo.cs
- AspNetCompatibilityRequirementsAttribute.cs
- CrossSiteScriptingValidation.cs
- DataQuery.cs
- PeerApplicationLaunchInfo.cs
- DataGridViewCellStyleConverter.cs
- TraceRecords.cs
- ScrollEvent.cs
- ElementProxy.cs
- Vector3DCollection.cs
- ResumeStoryboard.cs
- ExpressionServices.cs
- ChtmlFormAdapter.cs
- RestHandler.cs
- AppLevelCompilationSectionCache.cs
- ClientRolePrincipal.cs
- DynamicResourceExtension.cs
- SecurityException.cs