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
- ProfileManager.cs
- PageAsyncTaskManager.cs
- DataGridItem.cs
- DynamicPropertyHolder.cs
- DeploymentExceptionMapper.cs
- _AutoWebProxyScriptWrapper.cs
- HttpContextWrapper.cs
- ColorDialog.cs
- RecordsAffectedEventArgs.cs
- FixedPageAutomationPeer.cs
- WmlCommandAdapter.cs
- SqlNodeAnnotation.cs
- WebPartCollection.cs
- ImportContext.cs
- TemplatedWizardStep.cs
- XmlSchema.cs
- HybridDictionary.cs
- WizardStepBase.cs
- ToolBar.cs
- WasAdminWrapper.cs
- UnaryNode.cs
- StringFunctions.cs
- DateTimeValueSerializer.cs
- SchemaSetCompiler.cs
- SByteStorage.cs
- ScrollEvent.cs
- DataSet.cs
- PagerSettings.cs
- BaseParaClient.cs
- connectionpool.cs
- DataObject.cs
- DataGridViewCellEventArgs.cs
- ObjectCacheSettings.cs
- EventDescriptor.cs
- InstanceDataCollection.cs
- RequestCachePolicy.cs
- AnimatedTypeHelpers.cs
- UserControlAutomationPeer.cs
- DbProviderFactoriesConfigurationHandler.cs
- shaperfactoryquerycachekey.cs
- ErrorHandler.cs
- LineBreak.cs
- HwndSourceParameters.cs
- PointHitTestParameters.cs
- CultureTable.cs
- SubstitutionResponseElement.cs
- ValueConversionAttribute.cs
- XmlSchemaParticle.cs
- ViewEventArgs.cs
- SqlMethods.cs
- CaseStatementSlot.cs
- ADMembershipUser.cs
- CancelEventArgs.cs
- CollectionViewProxy.cs
- JapaneseLunisolarCalendar.cs
- TransformValueSerializer.cs
- PageContent.cs
- DataGridViewTextBoxEditingControl.cs
- SparseMemoryStream.cs
- Listen.cs
- DataKey.cs
- ManifestResourceInfo.cs
- InternalsVisibleToAttribute.cs
- LineServices.cs
- MultitargetingHelpers.cs
- CrossAppDomainChannel.cs
- Win32NamedPipes.cs
- ThreadStaticAttribute.cs
- UIElement3DAutomationPeer.cs
- EditingScopeUndoUnit.cs
- Size3DValueSerializer.cs
- ServiceActivationException.cs
- ValidationErrorCollection.cs
- PrivateFontCollection.cs
- OverlappedAsyncResult.cs
- WebPartHeaderCloseVerb.cs
- EnumValAlphaComparer.cs
- XslTransformFileEditor.cs
- SqlProviderServices.cs
- ForceCopyBuildProvider.cs
- MetadataItemEmitter.cs
- SqlFactory.cs
- InputQueue.cs
- EraserBehavior.cs
- EntityDataSourceSelectedEventArgs.cs
- SecurityPolicySection.cs
- TextDecorationCollection.cs
- DataGridViewHitTestInfo.cs
- PolyBezierSegment.cs
- PingReply.cs
- cookie.cs
- SoapHeaderAttribute.cs
- dataobject.cs
- ToolStripItemImageRenderEventArgs.cs
- GetRecipientRequest.cs
- MultiTrigger.cs
- HttpCookiesSection.cs
- ContextMenuStrip.cs
- ConcurrentDictionary.cs
- ObjectDataProvider.cs