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
- SoapUnknownHeader.cs
- CmsUtils.cs
- LinearQuaternionKeyFrame.cs
- TextSelection.cs
- SerializationInfoEnumerator.cs
- WorkflowServiceNamespace.cs
- GlobalizationSection.cs
- ConfigurationValidatorAttribute.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- ShaderEffect.cs
- Win32PrintDialog.cs
- DesignColumnCollection.cs
- ErrorHandler.cs
- WorkerRequest.cs
- PersonalizationProviderHelper.cs
- CreateRefExpr.cs
- OdbcEnvironmentHandle.cs
- FocusManager.cs
- MasterPageParser.cs
- FormViewPageEventArgs.cs
- SeekStoryboard.cs
- ToolStripScrollButton.cs
- OperationAbortedException.cs
- XmlSchemaValidationException.cs
- InputMethodStateTypeInfo.cs
- ImageCodecInfo.cs
- DoubleStorage.cs
- TemplateBindingExtension.cs
- DataGridDesigner.cs
- TextProviderWrapper.cs
- JsonUriDataContract.cs
- AppSecurityManager.cs
- ScriptManagerProxy.cs
- WorkflowControlClient.cs
- ComplexTypeEmitter.cs
- FunctionUpdateCommand.cs
- NamespaceCollection.cs
- Simplifier.cs
- FamilyCollection.cs
- StoryFragments.cs
- Persist.cs
- DrawingBrush.cs
- GeneratedCodeAttribute.cs
- DefaultObjectMappingItemCollection.cs
- ConfigurationManagerInternal.cs
- OverflowException.cs
- XPathChildIterator.cs
- StopStoryboard.cs
- NamespaceListProperty.cs
- XPathAncestorQuery.cs
- log.cs
- RoleGroupCollection.cs
- ProfilePropertyMetadata.cs
- DataIdProcessor.cs
- DbProviderFactory.cs
- ResourceReader.cs
- Semaphore.cs
- InternalDispatchObject.cs
- DeleteWorkflowOwnerCommand.cs
- XmlParser.cs
- Misc.cs
- WindowsRichEdit.cs
- CounterCreationDataCollection.cs
- Vertex.cs
- SplitterCancelEvent.cs
- PlainXmlWriter.cs
- CodeCatchClauseCollection.cs
- CodeTypeMember.cs
- OutputCacheModule.cs
- QueryAsyncResult.cs
- SqlDependencyListener.cs
- InArgument.cs
- MdiWindowListStrip.cs
- SurrogateEncoder.cs
- SrgsRule.cs
- LiteralTextParser.cs
- designeractionlistschangedeventargs.cs
- TraceContext.cs
- SchemaImporter.cs
- SmtpReplyReader.cs
- OdbcCommand.cs
- PersistenceProviderElement.cs
- PropertyIDSet.cs
- UshortList2.cs
- Literal.cs
- CorrelationTokenTypeConvertor.cs
- BaseCollection.cs
- SqlNodeAnnotations.cs
- CodeAttributeArgument.cs
- RoutedEventConverter.cs
- AuthenticateEventArgs.cs
- ElementHostAutomationPeer.cs
- DeferredSelectedIndexReference.cs
- SettingsAttributeDictionary.cs
- MarkupCompiler.cs
- SiteOfOriginContainer.cs
- MailHeaderInfo.cs
- ClientTargetCollection.cs
- WebPartDeleteVerb.cs
- SQLInt32Storage.cs