Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- COM2ColorConverter.cs
- NameValueCollection.cs
- ProtocolException.cs
- TdsParser.cs
- SelectionRange.cs
- SoapEnvelopeProcessingElement.cs
- Utilities.cs
- ComAdminWrapper.cs
- MSAANativeProvider.cs
- ButtonChrome.cs
- externdll.cs
- AssemblyName.cs
- SizeF.cs
- ExtensionsSection.cs
- SByteStorage.cs
- WebResourceAttribute.cs
- TreeChangeInfo.cs
- GridViewSortEventArgs.cs
- BindingsCollection.cs
- CompilationUnit.cs
- StreamUpdate.cs
- RegistrationServices.cs
- SqlReferenceCollection.cs
- SafeProcessHandle.cs
- DataControlPagerLinkButton.cs
- SelectionWordBreaker.cs
- DynamicResourceExtensionConverter.cs
- _CommandStream.cs
- HandlerMappingMemo.cs
- RootNamespaceAttribute.cs
- BitmapEffectInput.cs
- HMACRIPEMD160.cs
- NextPreviousPagerField.cs
- WebPartMenu.cs
- SqlMetaData.cs
- AuthenticationException.cs
- DataSourceCache.cs
- QualifiedCellIdBoolean.cs
- SimpleApplicationHost.cs
- FigureHelper.cs
- TableLayoutRowStyleCollection.cs
- BevelBitmapEffect.cs
- EntityContainerEntitySetDefiningQuery.cs
- DataTableMappingCollection.cs
- CloudCollection.cs
- RenamedEventArgs.cs
- HyperLinkStyle.cs
- MsmqIntegrationSecurityElement.cs
- IndexOutOfRangeException.cs
- BindingWorker.cs
- BitmapEffect.cs
- SystemKeyConverter.cs
- ExeConfigurationFileMap.cs
- Animatable.cs
- QueryParameter.cs
- SafeIUnknown.cs
- ViewManager.cs
- UnsafeNativeMethodsTablet.cs
- SqlBulkCopy.cs
- SplitterEvent.cs
- FixedPosition.cs
- ObjectStateManagerMetadata.cs
- MediaElement.cs
- FeatureAttribute.cs
- VerificationException.cs
- ForceCopyBuildProvider.cs
- ParameterCollectionEditorForm.cs
- TextTreeFixupNode.cs
- InvalidOleVariantTypeException.cs
- HtmlMeta.cs
- ComplexType.cs
- SqlFormatter.cs
- XmlSchemaObjectTable.cs
- ArgIterator.cs
- BaseValidator.cs
- MultipartIdentifier.cs
- AssertFilter.cs
- VoiceInfo.cs
- ConfigurationValidatorBase.cs
- CAGDesigner.cs
- Size.cs
- DropShadowEffect.cs
- PartialTrustVisibleAssembliesSection.cs
- ClientConfigurationHost.cs
- Fonts.cs
- XmlIgnoreAttribute.cs
- RegexRunner.cs
- MultipartContentParser.cs
- Point4D.cs
- DoubleAnimationClockResource.cs
- PrivilegedConfigurationManager.cs
- StylusEditingBehavior.cs
- LogicalExpr.cs
- SimpleHandlerBuildProvider.cs
- HtmlElementCollection.cs
- CompiledQueryCacheEntry.cs
- Console.cs
- UmAlQuraCalendar.cs
- DuplicateWaitObjectException.cs
- RuntimeHelpers.cs