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
- DataColumnCollection.cs
- Win32Native.cs
- SQLBoolean.cs
- ACE.cs
- ChannelManagerHelpers.cs
- DefaultWorkflowSchedulerService.cs
- COM2IDispatchConverter.cs
- References.cs
- TypeDescriptorContext.cs
- RelationshipDetailsCollection.cs
- AlphaSortedEnumConverter.cs
- XmlDomTextWriter.cs
- AsmxEndpointPickerExtension.cs
- TypeConverterMarkupExtension.cs
- HyperLinkField.cs
- JsonWriterDelegator.cs
- Number.cs
- EntityDataSourceContextDisposingEventArgs.cs
- StateChangeEvent.cs
- BinaryEditor.cs
- SystemPens.cs
- KeyFrames.cs
- SQLCharsStorage.cs
- ContentElementCollection.cs
- FlatButtonAppearance.cs
- ShaperBuffers.cs
- ResourcePermissionBase.cs
- ExecutionScope.cs
- Label.cs
- NullableDecimalMinMaxAggregationOperator.cs
- ItemCheckEvent.cs
- Condition.cs
- PageCache.cs
- VScrollProperties.cs
- ProcessModule.cs
- SectionRecord.cs
- propertytag.cs
- StreamAsIStream.cs
- QilPatternVisitor.cs
- CodeAttributeArgument.cs
- SecurityPolicySection.cs
- DataFieldEditor.cs
- FontWeight.cs
- DependencyObject.cs
- EditorZone.cs
- StrokeNodeOperations2.cs
- TableParagraph.cs
- CodeParameterDeclarationExpressionCollection.cs
- InvalidWMPVersionException.cs
- TextRenderer.cs
- TranslateTransform3D.cs
- PrintPreviewControl.cs
- CalendarAutoFormatDialog.cs
- TextWriter.cs
- ListViewDeleteEventArgs.cs
- ControlDesigner.cs
- SqlDataSourceAdvancedOptionsForm.cs
- DataReaderContainer.cs
- NavigationExpr.cs
- CapabilitiesState.cs
- PreloadedPackages.cs
- LocalIdKeyIdentifierClause.cs
- StreamGeometryContext.cs
- FormViewUpdatedEventArgs.cs
- AppSecurityManager.cs
- BitmapEffectrendercontext.cs
- MultiAsyncResult.cs
- InfoCardArgumentException.cs
- TimelineGroup.cs
- Transform.cs
- ColorIndependentAnimationStorage.cs
- UITypeEditor.cs
- TextEditorCharacters.cs
- Label.cs
- PageThemeParser.cs
- OrderingExpression.cs
- RowTypePropertyElement.cs
- CodeNamespaceCollection.cs
- MessageSecurityVersion.cs
- X509Chain.cs
- OperationResponse.cs
- COM2ICategorizePropertiesHandler.cs
- XmlAnyAttributeAttribute.cs
- FullTrustAssemblyCollection.cs
- ExpressionEditorSheet.cs
- WebPartMinimizeVerb.cs
- ReadOnlyAttribute.cs
- PageHandlerFactory.cs
- TextRange.cs
- __Filters.cs
- InstanceNameConverter.cs
- CustomCategoryAttribute.cs
- SchemaNamespaceManager.cs
- LayoutTable.cs
- TrackingLocationCollection.cs
- sqlcontext.cs
- BufferedStream.cs
- ColorInterpolationModeValidation.cs
- XsdDuration.cs
- WebZone.cs