Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / xsp / System / Web / Extensions / Script / Services / ProxyGenerator.cs / 1 / ProxyGenerator.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Script.Services { using System; using System.Globalization; using System.Security.Permissions; using System.ServiceModel; using System.Web.Resources; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { 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); } 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.Security.Permissions; using System.ServiceModel; using System.Web.Resources; [AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public static class ProxyGenerator { public static string GetClientProxyScript(Type type, string path, bool debug) { 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); } 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
- RequestResponse.cs
- ImageFormatConverter.cs
- ConnectionInterfaceCollection.cs
- DPTypeDescriptorContext.cs
- SvcMapFileLoader.cs
- HttpBufferlessInputStream.cs
- CrossSiteScriptingValidation.cs
- CollectionContainer.cs
- PrinterUnitConvert.cs
- SmuggledIUnknown.cs
- StickyNoteContentControl.cs
- DirectoryObjectSecurity.cs
- ThicknessAnimation.cs
- RemoveStoryboard.cs
- PageHandlerFactory.cs
- HttpPostProtocolImporter.cs
- ConfigXmlAttribute.cs
- AnnotationService.cs
- NavigationService.cs
- BrowserCapabilitiesCodeGenerator.cs
- FileSecurity.cs
- PropertyToken.cs
- Converter.cs
- ObjectAnimationBase.cs
- EntityException.cs
- CodeBinaryOperatorExpression.cs
- FunctionDescription.cs
- LinqDataSourceDisposeEventArgs.cs
- ColorContext.cs
- DefaultMemberAttribute.cs
- XmlIterators.cs
- ProviderCollection.cs
- DataBoundLiteralControl.cs
- HttpConfigurationContext.cs
- LinearKeyFrames.cs
- SerializationException.cs
- SolidColorBrush.cs
- EntityDataSourceStatementEditor.cs
- SamlSerializer.cs
- XmlAttributes.cs
- Help.cs
- TrackingLocationCollection.cs
- ValidatorCompatibilityHelper.cs
- StandardCommands.cs
- OleServicesContext.cs
- TraceFilter.cs
- PointCollection.cs
- SqlDuplicator.cs
- UriSection.cs
- ServiceHostFactory.cs
- BasicAsyncResult.cs
- UpdatePanelTrigger.cs
- DependencyPropertyConverter.cs
- Connector.xaml.cs
- AnimatedTypeHelpers.cs
- BindingCompleteEventArgs.cs
- basecomparevalidator.cs
- Propagator.cs
- DataGridViewCellCollection.cs
- TimeSpan.cs
- PolicyDesigner.cs
- InboundActivityHelper.cs
- ClaimTypeElement.cs
- StyleXamlParser.cs
- DrawingImage.cs
- TextTreeFixupNode.cs
- XsdBuildProvider.cs
- FormViewInsertEventArgs.cs
- InvokerUtil.cs
- JoinGraph.cs
- PrincipalPermission.cs
- MinimizableAttributeTypeConverter.cs
- CapiHashAlgorithm.cs
- EncoderReplacementFallback.cs
- PeerInvitationResponse.cs
- OdbcDataReader.cs
- RawUIStateInputReport.cs
- SystemColors.cs
- Helpers.cs
- DetailsViewRow.cs
- InputProcessorProfiles.cs
- PeerObject.cs
- StatusBarItemAutomationPeer.cs
- PackageDigitalSignatureManager.cs
- NextPreviousPagerField.cs
- FormViewPagerRow.cs
- LongValidator.cs
- AttributeProviderAttribute.cs
- DataGridViewComboBoxColumnDesigner.cs
- DrawingGroup.cs
- TextRangeBase.cs
- DBDataPermissionAttribute.cs
- SQLInt32.cs
- PreloadedPackages.cs
- CodeAccessPermission.cs
- controlskin.cs
- DefaultCommandExtensionCallback.cs
- DefaultProxySection.cs
- XmlUTF8TextWriter.cs
- unsafenativemethodsother.cs