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
- KnownAssemblyEntry.cs
- DiscoveryMessageSequenceCD1.cs
- CurrentChangedEventManager.cs
- HttpListenerPrefixCollection.cs
- CapabilitiesState.cs
- SelectionRange.cs
- ConfigurationSectionCollection.cs
- XpsImage.cs
- ContainerUIElement3D.cs
- LinkClickEvent.cs
- ClientFormsIdentity.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- _SingleItemRequestCache.cs
- AppDomain.cs
- PartitionResolver.cs
- ToolStripComboBox.cs
- RuleRef.cs
- ValidationPropertyAttribute.cs
- SqlRowUpdatingEvent.cs
- PaperSource.cs
- WmlLabelAdapter.cs
- xmlsaver.cs
- ErrorFormatterPage.cs
- MexTcpBindingCollectionElement.cs
- SafeSecurityHandles.cs
- ProcessHost.cs
- srgsitem.cs
- FileDialogCustomPlacesCollection.cs
- ComPersistableTypeElementCollection.cs
- MetabaseReader.cs
- TableLayoutSettingsTypeConverter.cs
- XmlnsCompatibleWithAttribute.cs
- TemplateEditingService.cs
- Stylesheet.cs
- SqlUtils.cs
- FixedLineResult.cs
- ValueTypeFieldReference.cs
- SqlBulkCopyColumnMappingCollection.cs
- CreateUserWizardDesigner.cs
- ObjectSelectorEditor.cs
- StringAnimationBase.cs
- ToolStripPanel.cs
- ProfileManager.cs
- StringUtil.cs
- HybridObjectCache.cs
- FormViewPagerRow.cs
- activationcontext.cs
- SqlReferenceCollection.cs
- DesignerVerb.cs
- BooleanAnimationUsingKeyFrames.cs
- _BasicClient.cs
- PostBackOptions.cs
- SamlAudienceRestrictionCondition.cs
- Normalizer.cs
- SoapException.cs
- QilBinary.cs
- TextTreeInsertElementUndoUnit.cs
- OperatorExpressions.cs
- DefaultTextStore.cs
- LifetimeManager.cs
- InstanceNotReadyException.cs
- XmlSchemaInferenceException.cs
- DiffuseMaterial.cs
- UIElementAutomationPeer.cs
- GlobalizationAssembly.cs
- ConfigXmlText.cs
- MetabaseServerConfig.cs
- HtmlLink.cs
- ChtmlTextWriter.cs
- ProvidePropertyAttribute.cs
- ServiceOperationWrapper.cs
- ParagraphResult.cs
- DependencyStoreSurrogate.cs
- TableRow.cs
- ExpressionEditorSheet.cs
- DeflateStream.cs
- SortQuery.cs
- RbTree.cs
- VScrollProperties.cs
- DesigntimeLicenseContext.cs
- ToolTip.cs
- AssemblyFilter.cs
- ObjectDataProvider.cs
- X509Certificate2Collection.cs
- GroupBoxDesigner.cs
- ToolBarButtonClickEvent.cs
- DependencyObjectPropertyDescriptor.cs
- UnionExpr.cs
- TreeNodeStyle.cs
- SettingsAttributes.cs
- WebPartHeaderCloseVerb.cs
- TypedElement.cs
- NumberFormatter.cs
- DesignerOptionService.cs
- ColumnResizeAdorner.cs
- RectangleConverter.cs
- OutputCacheModule.cs
- SubMenuStyle.cs
- Win32PrintDialog.cs
- TextEditorThreadLocalStore.cs