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
- SQLGuidStorage.cs
- Pair.cs
- RectangleGeometry.cs
- GroupItem.cs
- XmlWriter.cs
- xamlnodes.cs
- ToolStripDropDownDesigner.cs
- AuthenticationSection.cs
- WebPartCancelEventArgs.cs
- AuthorizationSection.cs
- CustomErrorCollection.cs
- Comparer.cs
- DBProviderConfigurationHandler.cs
- CustomCategoryAttribute.cs
- WebEventTraceProvider.cs
- TreeView.cs
- Unit.cs
- ParameterSubsegment.cs
- DataServiceQueryProvider.cs
- UriParserTemplates.cs
- Base64Encoder.cs
- PropertyBuilder.cs
- _Rfc2616CacheValidators.cs
- GenericUriParser.cs
- DataGridCell.cs
- AnchoredBlock.cs
- DrawingContextWalker.cs
- DataGridRow.cs
- XComponentModel.cs
- HostedHttpRequestAsyncResult.cs
- DataStorage.cs
- OracleTransaction.cs
- MimeAnyImporter.cs
- XmlSchemaImporter.cs
- XmlDocumentSerializer.cs
- PathStreamGeometryContext.cs
- XmlILModule.cs
- ZipFileInfo.cs
- AudioStateChangedEventArgs.cs
- ListControlStringCollectionEditor.cs
- SessionPageStateSection.cs
- SystemEvents.cs
- TextRangeEditTables.cs
- WindowAutomationPeer.cs
- SetterBase.cs
- Timer.cs
- mediaclock.cs
- TextBoxAutoCompleteSourceConverter.cs
- CfgParser.cs
- ClaimSet.cs
- CodeTypeMember.cs
- System.Data_BID.cs
- Environment.cs
- TabControlEvent.cs
- Expressions.cs
- Unit.cs
- DataControlLinkButton.cs
- ObjectTag.cs
- CompositeDispatchFormatter.cs
- XmlTextReaderImplHelpers.cs
- Ipv6Element.cs
- TypographyProperties.cs
- WindowsSecurityTokenAuthenticator.cs
- _ServiceNameStore.cs
- SQLBytesStorage.cs
- OperationContext.cs
- DictionaryBase.cs
- OleDbConnection.cs
- ParagraphResult.cs
- WindowsButton.cs
- WebHttpElement.cs
- XmlObjectSerializerReadContext.cs
- IdentityReference.cs
- HandlerFactoryCache.cs
- PageEventArgs.cs
- IDReferencePropertyAttribute.cs
- MarshalDirectiveException.cs
- ActivityTrace.cs
- FileVersionInfo.cs
- LineBreakRecord.cs
- Stylesheet.cs
- SwitchElementsCollection.cs
- HtmlTitle.cs
- X509Certificate2.cs
- RawTextInputReport.cs
- SignedXml.cs
- PreviewPrintController.cs
- HttpServerVarsCollection.cs
- CompiledXpathExpr.cs
- UnknownWrapper.cs
- DeclaredTypeValidator.cs
- IUnknownConstantAttribute.cs
- AttachInfo.cs
- TreeNodeBindingCollection.cs
- RangeValuePattern.cs
- OracleDataReader.cs
- CustomPopupPlacement.cs
- MemoryMappedFileSecurity.cs
- GroupJoinQueryOperator.cs
- Int16AnimationUsingKeyFrames.cs