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
- EntityContainerEntitySetDefiningQuery.cs
- KeyTimeConverter.cs
- NavigationProperty.cs
- XslNumber.cs
- PreservationFileWriter.cs
- PlainXmlSerializer.cs
- ServiceOperation.cs
- ServiceReference.cs
- CustomWebEventKey.cs
- SequenceDesigner.cs
- NumericUpDown.cs
- MimeBasePart.cs
- ImageIndexConverter.cs
- DeploymentExceptionMapper.cs
- XsltContext.cs
- ThreadPool.cs
- TabPage.cs
- Formatter.cs
- NumericExpr.cs
- DataSourceXmlAttributeAttribute.cs
- ZoneIdentityPermission.cs
- SetterBase.cs
- EncoderReplacementFallback.cs
- BooleanAnimationBase.cs
- _NetworkingPerfCounters.cs
- SelectionItemPattern.cs
- NonSerializedAttribute.cs
- WSMessageEncoding.cs
- XmlAnyAttributeAttribute.cs
- SizeConverter.cs
- DragSelectionMessageFilter.cs
- Constant.cs
- ArraySortHelper.cs
- WebResourceAttribute.cs
- BuildManagerHost.cs
- SystemResources.cs
- UIElement3DAutomationPeer.cs
- SymbolPair.cs
- Crypto.cs
- ListViewGroup.cs
- HttpListenerException.cs
- CryptoApi.cs
- _AcceptOverlappedAsyncResult.cs
- DataBinder.cs
- MultiTrigger.cs
- XNodeValidator.cs
- ComplexBindingPropertiesAttribute.cs
- ObjectItemCollection.cs
- EarlyBoundInfo.cs
- ISFClipboardData.cs
- TextEffectCollection.cs
- EdmFunctionAttribute.cs
- ExpressionBuilder.cs
- CaseInsensitiveComparer.cs
- PointHitTestParameters.cs
- RegexWriter.cs
- ConfigXmlAttribute.cs
- KeyBinding.cs
- SizeIndependentAnimationStorage.cs
- SQLDecimal.cs
- TypedElement.cs
- StringDictionaryWithComparer.cs
- StrongNameSignatureInformation.cs
- PerspectiveCamera.cs
- SqlDataSource.cs
- WebPartMinimizeVerb.cs
- ControlParser.cs
- WindowsListViewItemStartMenu.cs
- ScrollChrome.cs
- FirstMatchCodeGroup.cs
- ProcessStartInfo.cs
- FlagsAttribute.cs
- OneOfElement.cs
- WindowsMenu.cs
- CombinedHttpChannel.cs
- StatusBar.cs
- WebBrowserNavigatingEventHandler.cs
- TextAnchor.cs
- XmlUtf8RawTextWriter.cs
- JavaScriptObjectDeserializer.cs
- XmlSchemaParticle.cs
- VerbConverter.cs
- HttpWebRequestElement.cs
- UnsafeNativeMethods.cs
- HttpClientCertificate.cs
- SmiXetterAccessMap.cs
- QueryResult.cs
- ComboBoxItem.cs
- httpserverutility.cs
- NamedServiceModelExtensionCollectionElement.cs
- ConnectionsZoneAutoFormat.cs
- DocumentationServerProtocol.cs
- DbConnectionPoolGroup.cs
- StoreContentChangedEventArgs.cs
- AppendHelper.cs
- Crc32.cs
- FileChangesMonitor.cs
- sitestring.cs
- EmbeddedMailObjectsCollection.cs
- ProbeDuplexAsyncResult.cs