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
- EntityDataSourceDesigner.cs
- ExpandableObjectConverter.cs
- RangeExpression.cs
- ObjectPropertyMapping.cs
- BitmapEffectOutputConnector.cs
- ProtocolException.cs
- AssemblyHash.cs
- Image.cs
- RequestNavigateEventArgs.cs
- CompilationUtil.cs
- ReturnValue.cs
- ExpandedWrapper.cs
- DataRecord.cs
- XmlReflectionMember.cs
- CryptoApi.cs
- TypeDependencyAttribute.cs
- DataGridViewColumn.cs
- AnnotationHighlightLayer.cs
- ServiceReference.cs
- WeakReference.cs
- XhtmlBasicFormAdapter.cs
- SafeHandles.cs
- SettingsAttributeDictionary.cs
- PublisherIdentityPermission.cs
- MenuItemCollection.cs
- BitmapDownload.cs
- AndCondition.cs
- ObjectStateFormatter.cs
- ToolbarAUtomationPeer.cs
- TypeBuilderInstantiation.cs
- FtpCachePolicyElement.cs
- XmlMembersMapping.cs
- JournalEntry.cs
- WasEndpointConfigContainer.cs
- SQLDecimal.cs
- PageCatalogPart.cs
- ArrangedElementCollection.cs
- LinkedList.cs
- HMACSHA1.cs
- Utils.cs
- UrlSyndicationContent.cs
- BitmapSourceSafeMILHandle.cs
- DashStyle.cs
- LinqDataSourceView.cs
- ObjectListField.cs
- QueryCacheManager.cs
- ToolStripButton.cs
- AxDesigner.cs
- BevelBitmapEffect.cs
- DictionaryContent.cs
- Accessible.cs
- RichTextBoxContextMenu.cs
- SmtpMail.cs
- DESCryptoServiceProvider.cs
- Item.cs
- StringArrayEditor.cs
- EdmScalarPropertyAttribute.cs
- TemplateContentLoader.cs
- AsymmetricSecurityBindingElement.cs
- Part.cs
- ScriptControlManager.cs
- WebBrowser.cs
- TextEditorTables.cs
- ObjectComplexPropertyMapping.cs
- DataSourceControl.cs
- WindowsClientElement.cs
- MaskDesignerDialog.cs
- XmlBinaryReader.cs
- RegionData.cs
- EndEvent.cs
- PositiveTimeSpanValidatorAttribute.cs
- ExecutorLocksHeldException.cs
- CompilerLocalReference.cs
- DecoderBestFitFallback.cs
- SecurityElement.cs
- AssemblyCollection.cs
- StoreItemCollection.cs
- SplineQuaternionKeyFrame.cs
- Cursor.cs
- KeyGestureConverter.cs
- DataView.cs
- SocketInformation.cs
- ConfigsHelper.cs
- UnsafeNativeMethods.cs
- FaultHandlingFilter.cs
- StyleCollection.cs
- SqlRewriteScalarSubqueries.cs
- NumericUpDownAccelerationCollection.cs
- StandardOleMarshalObject.cs
- ProfileManager.cs
- MetadataArtifactLoaderFile.cs
- BadImageFormatException.cs
- RemotingConfiguration.cs
- CodePageEncoding.cs
- CqlParser.cs
- SEHException.cs
- OptimizedTemplateContent.cs
- PresentationAppDomainManager.cs
- WebContext.cs
- Validator.cs