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
- SimpleBitVector32.cs
- TypeUnloadedException.cs
- PackageProperties.cs
- ZipIOLocalFileHeader.cs
- DbProviderFactoriesConfigurationHandler.cs
- VirtualizingStackPanel.cs
- HttpApplicationFactory.cs
- WpfSharedXamlSchemaContext.cs
- ListQueryResults.cs
- BuildProviderUtils.cs
- CodeCompiler.cs
- NetworkInformationException.cs
- DynamicRenderer.cs
- CustomError.cs
- TextServicesContext.cs
- WorkflowWebHostingModule.cs
- TokenizerHelper.cs
- HttpListenerResponse.cs
- StickyNoteContentControl.cs
- DefaultAssemblyResolver.cs
- InternalCache.cs
- ToolboxCategoryItems.cs
- DataGridViewTextBoxCell.cs
- OutputWindow.cs
- IDataContractSurrogate.cs
- WinHttpWebProxyFinder.cs
- ProxyAssemblyNotLoadedException.cs
- SqlCacheDependencyDatabase.cs
- RuntimeEnvironment.cs
- SignatureHelper.cs
- FtpRequestCacheValidator.cs
- FlowDocumentScrollViewer.cs
- CanExecuteRoutedEventArgs.cs
- CircleHotSpot.cs
- MemoryFailPoint.cs
- Matrix3DStack.cs
- TargetPerspective.cs
- ColumnWidthChangedEvent.cs
- DynamicILGenerator.cs
- SafeSecurityHelper.cs
- CopyCodeAction.cs
- NameValueConfigurationElement.cs
- ByteAnimationUsingKeyFrames.cs
- TraceHandler.cs
- LineBreak.cs
- HybridObjectCache.cs
- DesignerGenericWebPart.cs
- RectangleConverter.cs
- CollectionMarkupSerializer.cs
- InplaceBitmapMetadataWriter.cs
- RoleGroupCollection.cs
- Msmq3PoisonHandler.cs
- InheritanceRules.cs
- SecurityRuntime.cs
- Matrix.cs
- SimpleLine.cs
- ConvertEvent.cs
- IgnoreDataMemberAttribute.cs
- UnsafeNativeMethods.cs
- ClosableStream.cs
- WindowsAuthenticationModule.cs
- ItemChangedEventArgs.cs
- TableLayoutStyleCollection.cs
- Win32SafeHandles.cs
- OutputScopeManager.cs
- ObjectPersistData.cs
- ProfileWorkflowElement.cs
- SR.cs
- VoiceObjectToken.cs
- ControlBuilderAttribute.cs
- CatalogZoneAutoFormat.cs
- RequestCacheEntry.cs
- HttpApplicationFactory.cs
- XsltQilFactory.cs
- XmlSchemaInfo.cs
- SchemaNotation.cs
- OutOfProcStateClientManager.cs
- ReadOnlyTernaryTree.cs
- CommandEventArgs.cs
- FreezableCollection.cs
- EdmItemError.cs
- XomlDesignerLoader.cs
- DbDataSourceEnumerator.cs
- XmlSchemaCollection.cs
- NCryptNative.cs
- CodeTypeConstructor.cs
- objectresult_tresulttype.cs
- DesignTimeType.cs
- HashHelper.cs
- ProtocolsConfiguration.cs
- TextBoxView.cs
- _DomainName.cs
- ImageMetadata.cs
- ContentIterators.cs
- Switch.cs
- RegisteredDisposeScript.cs
- TableSectionStyle.cs
- AppDomainProtocolHandler.cs
- HostedTcpTransportManager.cs
- SamlDoNotCacheCondition.cs