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
- DbConnectionPoolGroupProviderInfo.cs
- PrintController.cs
- RoutedCommand.cs
- DataSourceGroupCollection.cs
- DataGridViewColumn.cs
- DragCompletedEventArgs.cs
- CodeGotoStatement.cs
- SqlDataSourceDesigner.cs
- XmlEntityReference.cs
- FixedFindEngine.cs
- TrackingProfile.cs
- LoginDesignerUtil.cs
- LoadWorkflowByKeyAsyncResult.cs
- HandledEventArgs.cs
- DataGridSortCommandEventArgs.cs
- Merger.cs
- HtmlUtf8RawTextWriter.cs
- MasterPageCodeDomTreeGenerator.cs
- InstanceLockLostException.cs
- DataGridViewCellFormattingEventArgs.cs
- OleDbCommand.cs
- GlyphingCache.cs
- BitmapEffectInputData.cs
- WebPartAuthorizationEventArgs.cs
- ListControlConvertEventArgs.cs
- _ConnectOverlappedAsyncResult.cs
- PeerDuplexChannelListener.cs
- ValidationService.cs
- SendOperation.cs
- RuntimeHandles.cs
- UIElementHelper.cs
- UInt16.cs
- CommentAction.cs
- DigestTraceRecordHelper.cs
- Literal.cs
- HostingEnvironmentWrapper.cs
- ObjectHelper.cs
- Rules.cs
- HttpTransportManager.cs
- WebReference.cs
- FileDataSourceCache.cs
- HttpListenerContext.cs
- PhotoPrintingIntent.cs
- LogFlushAsyncResult.cs
- SeekStoryboard.cs
- EdmToObjectNamespaceMap.cs
- StylusTip.cs
- GestureRecognizer.cs
- DataServiceQueryOfT.cs
- DateTimeFormatInfoScanner.cs
- SafeFileMappingHandle.cs
- DefaultValidator.cs
- MasterPage.cs
- RuntimeIdentifierPropertyAttribute.cs
- PictureBox.cs
- TabControl.cs
- AggregateException.cs
- User.cs
- HandlerFactoryWrapper.cs
- FixedSOMPageConstructor.cs
- DropShadowEffect.cs
- TextPointerBase.cs
- Type.cs
- HttpWebRequest.cs
- TimerElapsedEvenArgs.cs
- StrokeCollection.cs
- ObjectStateEntryDbDataRecord.cs
- FuncCompletionCallbackWrapper.cs
- CursorInteropHelper.cs
- Image.cs
- FormsAuthenticationTicket.cs
- ConstNode.cs
- WebPartsPersonalization.cs
- ValidationErrorEventArgs.cs
- StylusTip.cs
- ImageListUtils.cs
- FontInfo.cs
- CachedTypeface.cs
- TransformDescriptor.cs
- DeviceContext.cs
- FactoryGenerator.cs
- _NtlmClient.cs
- OutOfMemoryException.cs
- EventHandlersStore.cs
- RectConverter.cs
- CodeSnippetExpression.cs
- bindurihelper.cs
- VirtualizingPanel.cs
- Int64Converter.cs
- OutputCacheSection.cs
- CacheAxisQuery.cs
- SafeFileHandle.cs
- ImportDesigner.xaml.cs
- ObjectDataSourceFilteringEventArgs.cs
- TerminatorSinks.cs
- ByteRangeDownloader.cs
- AbandonedMutexException.cs
- BitmapFrameEncode.cs
- SelectionRange.cs
- OutOfMemoryException.cs