Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataWeb / Server / System / Data / Services / MimeTypeAttribute.cs / 1305376 / 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.Linq;
using System.Reflection;
///
/// 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 instance with
/// the specified MIME type.
///
/// 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;
}
/// 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 ; null
/// if no attribute is declared.
///
internal static MimeTypeAttribute GetMimeTypeAttribute(MemberInfo member)
{
Debug.Assert(member != null, "member != null");
return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true)
.Cast()
.FirstOrDefault(o => o.MemberName == member.Name);
}
}
}
// 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.Linq;
using System.Reflection;
///
/// 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 instance with
/// the specified MIME type.
///
/// 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;
}
/// 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 ; null
/// if no attribute is declared.
///
internal static MimeTypeAttribute GetMimeTypeAttribute(MemberInfo member)
{
Debug.Assert(member != null, "member != null");
return member.ReflectedType.GetCustomAttributes(typeof(MimeTypeAttribute), true)
.Cast()
.FirstOrDefault(o => o.MemberName == member.Name);
}
}
}
// 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
- DateTimeConverter2.cs
- SingleSelectRootGridEntry.cs
- WorkItem.cs
- QueryStringParameter.cs
- LineVisual.cs
- OleDbError.cs
- Empty.cs
- CharacterBufferReference.cs
- DataGridViewRowsAddedEventArgs.cs
- EraserBehavior.cs
- UInt16Storage.cs
- CuspData.cs
- PropertyContainer.cs
- Point.cs
- AttributeEmitter.cs
- SimpleLine.cs
- ArgumentException.cs
- NativeMethods.cs
- BinaryNode.cs
- Assign.cs
- FormatterServices.cs
- Column.cs
- LoginUtil.cs
- TimersDescriptionAttribute.cs
- DataTableClearEvent.cs
- HoistedLocals.cs
- EmptyControlCollection.cs
- BaseTemplateBuildProvider.cs
- CodeDelegateInvokeExpression.cs
- ApplicationDirectoryMembershipCondition.cs
- ParallelTimeline.cs
- TemplateXamlParser.cs
- StylusLogic.cs
- DataRowView.cs
- View.cs
- ValidateNames.cs
- PersistenceTypeAttribute.cs
- StructuralCache.cs
- ObjectConverter.cs
- UnmanagedMemoryStream.cs
- WindowsIdentity.cs
- ForwardPositionQuery.cs
- DocumentScope.cs
- MappedMetaModel.cs
- Matrix.cs
- InternalControlCollection.cs
- WsdlBuildProvider.cs
- GiveFeedbackEventArgs.cs
- DBConnection.cs
- Button.cs
- CodeExporter.cs
- SchemaDeclBase.cs
- TileBrush.cs
- VectorCollection.cs
- QilXmlReader.cs
- TempFiles.cs
- xdrvalidator.cs
- COM2FontConverter.cs
- __FastResourceComparer.cs
- HtmlPageAdapter.cs
- SharedPerformanceCounter.cs
- RelationshipConstraintValidator.cs
- SqlDataSourceWizardForm.cs
- TypeUtil.cs
- XmlStringTable.cs
- ExpressionWriter.cs
- ApplicationBuildProvider.cs
- CapiSafeHandles.cs
- Native.cs
- SizeAnimationClockResource.cs
- Config.cs
- WindowsListViewSubItem.cs
- OleDbError.cs
- InputScope.cs
- SystemTcpStatistics.cs
- StreamUpdate.cs
- Registry.cs
- ObjectListCommandsPage.cs
- AlgoModule.cs
- XmlDataSource.cs
- MemberMaps.cs
- OrderedDictionary.cs
- SoapMessage.cs
- DataGridParentRows.cs
- ImportOptions.cs
- SystemIPGlobalStatistics.cs
- XmlElementAttribute.cs
- OrthographicCamera.cs
- SspiWrapper.cs
- NativeMethods.cs
- BindingCollection.cs
- SendMessageContent.cs
- TemplateField.cs
- Fonts.cs
- EntitySqlQueryCacheKey.cs
- PartialCachingAttribute.cs
- Int32KeyFrameCollection.cs
- DocumentSequenceHighlightLayer.cs
- UriParserTemplates.cs
- DesignBindingConverter.cs