Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- SafePointer.cs
- PageContentCollection.cs
- StringStorage.cs
- ProtocolElementCollection.cs
- MetadataException.cs
- PrintingPermission.cs
- Suspend.cs
- SourceFileBuildProvider.cs
- FormViewModeEventArgs.cs
- ControlCachePolicy.cs
- HostingEnvironmentException.cs
- SqlPersonalizationProvider.cs
- PeerEndPoint.cs
- SmtpException.cs
- EllipseGeometry.cs
- QueryCacheEntry.cs
- UnsafeNativeMethods.cs
- TaiwanCalendar.cs
- SubclassTypeValidatorAttribute.cs
- Base64Encoder.cs
- DefaultParameterValueAttribute.cs
- Annotation.cs
- Source.cs
- SQLRoleProvider.cs
- NumericUpDown.cs
- ChannelTraceRecord.cs
- ServiceBehaviorAttribute.cs
- CounterSample.cs
- ApplicationProxyInternal.cs
- HostedHttpContext.cs
- TypeSystem.cs
- SimpleMailWebEventProvider.cs
- MetadataWorkspace.cs
- QueryContinueDragEventArgs.cs
- GeneralTransformCollection.cs
- HtmlInputReset.cs
- ClientBuildManager.cs
- ComponentResourceKeyConverter.cs
- WindowsRebar.cs
- HttpProfileGroupBase.cs
- SqlCommandSet.cs
- DynamicUpdateCommand.cs
- TableDetailsRow.cs
- _ConnectOverlappedAsyncResult.cs
- Win32Native.cs
- DataGridState.cs
- SQLBinary.cs
- RawStylusActions.cs
- WebZone.cs
- StylusButton.cs
- TransportReplyChannelAcceptor.cs
- FieldNameLookup.cs
- XmlElementElement.cs
- BaseCodePageEncoding.cs
- LinqDataSourceHelper.cs
- RadioButtonBaseAdapter.cs
- UnsignedPublishLicense.cs
- AgileSafeNativeMemoryHandle.cs
- SchemaObjectWriter.cs
- LocalizableAttribute.cs
- PtsHost.cs
- EntityDataSourceSelectedEventArgs.cs
- CodeTypeReferenceCollection.cs
- SmtpSection.cs
- SqlCacheDependency.cs
- DataRowView.cs
- InitializerFacet.cs
- XmlUnspecifiedAttribute.cs
- TypeBuilderInstantiation.cs
- LocalizationComments.cs
- ConfigurationSectionHelper.cs
- PreviewPageInfo.cs
- FilteredXmlReader.cs
- TextTreeTextNode.cs
- ObjectKeyFrameCollection.cs
- DocumentStream.cs
- TagPrefixInfo.cs
- InternalDispatchObject.cs
- TextView.cs
- PipeStream.cs
- COAUTHINFO.cs
- TableCellCollection.cs
- FastPropertyAccessor.cs
- XmlAttributeCache.cs
- SecurityContextTokenValidationException.cs
- BitmapPalette.cs
- ConsoleCancelEventArgs.cs
- CounterSample.cs
- FaultDescriptionCollection.cs
- DesignerInterfaces.cs
- ObjectStateEntryDbDataRecord.cs
- ObjectConverter.cs
- ConcurrentQueue.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ExpressionsCollectionConverter.cs
- XmlQueryStaticData.cs
- ClientUriBehavior.cs
- XmlSchemaComplexContentRestriction.cs
- DesignerVerbCollection.cs
- RectAnimation.cs