Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataWeb / Server / System / Data / Services / MimeTypeAttribute.cs / 1 / MimeTypeAttribute.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a class to decorate properties and custom service // operations with a MIME type. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { using System; using System.Diagnostics; using System.Reflection; using System.Linq; ////// Use this attribute on a DataService service operation method /// or a data object property to indicate than the type returned is /// of a specific MIME type. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class MimeTypeAttribute : Attribute { ///Name of the attributed method or property. private readonly string memberName; ///MIME type for the attributed method or property. private readonly string mimeType; ////// Initializes a new /// Name of the attributed method or property. /// MIME type for the attributed method or property. public MimeTypeAttribute(string memberName, string mimeType) { this.memberName = memberName; this.mimeType = mimeType; } ///instance with /// the specified MIME type. /// Name of the attributed method or property. public string MemberName { get { return this.memberName; } } ////// MIME type for the attributed method or property. /// public string MimeType { get { return this.mimeType; } } ////// Gets the MIME type declared on the specified /// Member to check. ///. /// /// The MIME type declared on the specified internal static string GetMemberMimeType(MemberInfo member) { Debug.Assert(member != null, "member != null"); return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true) .Cast; null /// if no attribute is declared. /// () .Where (o => o.MemberName == member.Name) .Select (o => o.MimeType) .SingleOrDefault(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //// Provides a class to decorate properties and custom service // operations with a MIME type. // // // @owner [....] //--------------------------------------------------------------------- namespace System.Data.Services { using System; using System.Diagnostics; using System.Reflection; using System.Linq; ////// Use this attribute on a DataService service operation method /// or a data object property to indicate than the type returned is /// of a specific MIME type. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] public sealed class MimeTypeAttribute : Attribute { ///Name of the attributed method or property. private readonly string memberName; ///MIME type for the attributed method or property. private readonly string mimeType; ////// Initializes a new /// Name of the attributed method or property. /// MIME type for the attributed method or property. public MimeTypeAttribute(string memberName, string mimeType) { this.memberName = memberName; this.mimeType = mimeType; } ///instance with /// the specified MIME type. /// Name of the attributed method or property. public string MemberName { get { return this.memberName; } } ////// MIME type for the attributed method or property. /// public string MimeType { get { return this.mimeType; } } ////// Gets the MIME type declared on the specified /// Member to check. ///. /// /// The MIME type declared on the specified internal static string GetMemberMimeType(MemberInfo member) { Debug.Assert(member != null, "member != null"); return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true) .Cast; null /// if no attribute is declared. /// () .Where (o => o.MemberName == member.Name) .Select (o => o.MimeType) .SingleOrDefault(); } } } // 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
- SamlAuthorizationDecisionClaimResource.cs
- UserControlCodeDomTreeGenerator.cs
- _SSPIWrapper.cs
- StringResourceManager.cs
- SearchForVirtualItemEventArgs.cs
- LinqDataSourceHelper.cs
- StopRoutingHandler.cs
- MouseEvent.cs
- UxThemeWrapper.cs
- ScriptReference.cs
- TextBox.cs
- Int16KeyFrameCollection.cs
- HTTPNotFoundHandler.cs
- NotEqual.cs
- EventHandlersStore.cs
- UseLicense.cs
- WorkflowOperationContext.cs
- DbConnectionPoolIdentity.cs
- _SslState.cs
- ToolStripDropTargetManager.cs
- XmlDataDocument.cs
- MiniConstructorInfo.cs
- NonClientArea.cs
- SqlProcedureAttribute.cs
- ObjectItemLoadingSessionData.cs
- WebPartConnectionCollection.cs
- MobileListItemCollection.cs
- PeerTransportListenAddressConverter.cs
- WindowsMenu.cs
- StoreItemCollection.cs
- ServicePointManagerElement.cs
- Process.cs
- Contracts.cs
- InputScopeAttribute.cs
- TextTreeUndoUnit.cs
- TraceHandler.cs
- NativeMethodsCLR.cs
- AttachedPropertyDescriptor.cs
- DbConnectionPoolGroup.cs
- ScriptComponentDescriptor.cs
- RouteParser.cs
- DataMember.cs
- UInt64.cs
- ProcessHostServerConfig.cs
- LinkedList.cs
- BlobPersonalizationState.cs
- String.cs
- RangeContentEnumerator.cs
- SiteOfOriginContainer.cs
- HttpResponseWrapper.cs
- HtmlTableRowCollection.cs
- WindowsNonControl.cs
- ProviderConnectionPoint.cs
- CharacterBufferReference.cs
- GeneralTransform3D.cs
- NativeMethods.cs
- StreamResourceInfo.cs
- AuthenticationServiceManager.cs
- Bezier.cs
- HtmlPageAdapter.cs
- BasicBrowserDialog.designer.cs
- XmlAutoDetectWriter.cs
- HMAC.cs
- HyperLinkStyle.cs
- Geometry.cs
- CompilerScopeManager.cs
- HttpPostProtocolImporter.cs
- DependencyPropertyKind.cs
- StylusPlugin.cs
- IndexedWhereQueryOperator.cs
- Oid.cs
- BitmapFrame.cs
- sapiproxy.cs
- UnmanagedBitmapWrapper.cs
- CheckBox.cs
- DelegateTypeInfo.cs
- PTConverter.cs
- InvalidFilterCriteriaException.cs
- Parameter.cs
- XmlName.cs
- ConfigurationManagerHelperFactory.cs
- VirtualDirectoryMappingCollection.cs
- MultiSelector.cs
- TrackingDataItemValue.cs
- LongMinMaxAggregationOperator.cs
- CachedFontFamily.cs
- EFAssociationProvider.cs
- TypeBuilderInstantiation.cs
- ApplicationServiceManager.cs
- ConfigurationManager.cs
- DataPagerCommandEventArgs.cs
- SimpleLine.cs
- EncoderBestFitFallback.cs
- Annotation.cs
- RoleGroup.cs
- PeerResolverElement.cs
- DateRangeEvent.cs
- TreeNodeStyleCollection.cs
- Geometry3D.cs
- FieldAccessException.cs