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
- QueryCursorEventArgs.cs
- MergeLocalizationDirectives.cs
- DispatcherEventArgs.cs
- AuthStoreRoleProvider.cs
- SystemIPAddressInformation.cs
- DataGridViewRow.cs
- GetMemberBinder.cs
- Vector.cs
- StylusDevice.cs
- XPathSelfQuery.cs
- AssertFilter.cs
- FixedSOMElement.cs
- SmiMetaDataProperty.cs
- DynamicDocumentPaginator.cs
- RuleSettingsCollection.cs
- XmlDownloadManager.cs
- CompatibleComparer.cs
- CodeTypeReferenceCollection.cs
- XmlBindingWorker.cs
- IteratorFilter.cs
- MenuItemCollection.cs
- TimeIntervalCollection.cs
- IgnoreSectionHandler.cs
- BindUriHelper.cs
- BStrWrapper.cs
- WithStatement.cs
- TextElementEnumerator.cs
- DelegatingTypeDescriptionProvider.cs
- EqualityComparer.cs
- OptimizedTemplateContentHelper.cs
- ComponentEditorPage.cs
- StreamGeometry.cs
- XmlSchemaValidationException.cs
- ConfigurationFileMap.cs
- FilteredReadOnlyMetadataCollection.cs
- RoleManagerEventArgs.cs
- StaticSiteMapProvider.cs
- SmiRecordBuffer.cs
- Solver.cs
- Base64WriteStateInfo.cs
- Span.cs
- LowerCaseStringConverter.cs
- TimeSpan.cs
- regiisutil.cs
- ButtonAutomationPeer.cs
- SystemInformation.cs
- Message.cs
- MsmqChannelFactory.cs
- GeometryModel3D.cs
- PropertyFilterAttribute.cs
- ThreadExceptionEvent.cs
- NavigationWindow.cs
- Nodes.cs
- CodeDirectiveCollection.cs
- JumpItem.cs
- JoinCqlBlock.cs
- AndCondition.cs
- NameScope.cs
- SerializationInfo.cs
- WebPartConnectionsCancelVerb.cs
- SspiWrapper.cs
- ToolStripItemEventArgs.cs
- Internal.cs
- OleDbPermission.cs
- EventLogPermission.cs
- QuotaThrottle.cs
- ParameterModifier.cs
- TableLayoutSettingsTypeConverter.cs
- SafeProcessHandle.cs
- StickyNoteHelper.cs
- SimpleWebHandlerParser.cs
- GridViewEditEventArgs.cs
- base64Transforms.cs
- RedistVersionInfo.cs
- AbsoluteQuery.cs
- SerializationSectionGroup.cs
- DetailsViewInsertedEventArgs.cs
- dtdvalidator.cs
- httpapplicationstate.cs
- ExpressionBindings.cs
- InitializationEventAttribute.cs
- Point4D.cs
- DesignerDataConnection.cs
- SourceFileInfo.cs
- TextBoxBaseDesigner.cs
- MethodBuilder.cs
- InputManager.cs
- TextEffectCollection.cs
- KnownTypeHelper.cs
- GPRECTF.cs
- SafeNativeMethods.cs
- UnsafeNativeMethodsPenimc.cs
- BindingElementCollection.cs
- StateMachineAction.cs
- DynamicValidatorEventArgs.cs
- XmlSchemaNotation.cs
- DbConnectionPoolGroup.cs
- HttpRuntimeSection.cs
- InvalidOperationException.cs
- ZipIOFileItemStream.cs