Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- DiagnosticStrings.cs
- ProgressBar.cs
- XmlILTrace.cs
- ErrorFormatter.cs
- FixedSOMGroup.cs
- ExpressionPrefixAttribute.cs
- ContextStack.cs
- WindowsFormsSectionHandler.cs
- StringFunctions.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DrawingContextDrawingContextWalker.cs
- XpsFilter.cs
- control.ime.cs
- SqlNotificationRequest.cs
- XmlRawWriter.cs
- ProfileInfo.cs
- TypeInfo.cs
- DataGridColumnCollectionEditor.cs
- _BasicClient.cs
- KeyInterop.cs
- FileIOPermission.cs
- SortFieldComparer.cs
- MissingManifestResourceException.cs
- Messages.cs
- Column.cs
- TextDecoration.cs
- JoinElimination.cs
- MutexSecurity.cs
- PipelineModuleStepContainer.cs
- SchemaNames.cs
- TextRangeAdaptor.cs
- DataGridViewLinkCell.cs
- TextEndOfParagraph.cs
- DrawingVisual.cs
- X509Certificate2.cs
- ReadOnlyHierarchicalDataSource.cs
- Vars.cs
- SpotLight.cs
- DuplicateWaitObjectException.cs
- ReadWriteControlDesigner.cs
- DataControlReferenceCollection.cs
- CountAggregationOperator.cs
- PenCursorManager.cs
- DataListItemCollection.cs
- XmlElementCollection.cs
- FtpWebResponse.cs
- wgx_exports.cs
- LiteralTextParser.cs
- EntityTypeBase.cs
- Label.cs
- CodeAttributeArgumentCollection.cs
- ProxyWebPart.cs
- storepermission.cs
- DataColumn.cs
- AudioFormatConverter.cs
- ActiveXHelper.cs
- Metafile.cs
- DebugView.cs
- TraceXPathNavigator.cs
- TableLayoutStyle.cs
- WebServiceResponseDesigner.cs
- XmlAttributeProperties.cs
- ModuleConfigurationInfo.cs
- SessionState.cs
- ColumnMapCopier.cs
- DirectoryNotFoundException.cs
- Cell.cs
- NetworkInterface.cs
- DataGridViewCellStyleConverter.cs
- MeasurementDCInfo.cs
- PreservationFileReader.cs
- MemberRestriction.cs
- RenderOptions.cs
- ThumbButtonInfoCollection.cs
- VirtualStackFrame.cs
- serverconfig.cs
- ControlValuePropertyAttribute.cs
- DecoderFallback.cs
- GridLength.cs
- HandlerMappingMemo.cs
- MaskInputRejectedEventArgs.cs
- XmlSchemaObjectTable.cs
- FunctionDescription.cs
- OpenFileDialog.cs
- TypeConverter.cs
- Hyperlink.cs
- XamlTypeMapper.cs
- HostingEnvironmentSection.cs
- LineGeometry.cs
- SessionStateModule.cs
- Invariant.cs
- Environment.cs
- SEHException.cs
- TemplatedMailWebEventProvider.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- MSAAEventDispatcher.cs
- EntityContainerRelationshipSetEnd.cs
- ValueUtilsSmi.cs
- PropVariant.cs
- XmlAnyElementAttribute.cs