共用方式為


ExcludeAttribute 類別

指定實體成員將不會出現在該實體之程式碼產生的用戶端檢視中,而且該值永遠不應傳送至用戶端。

命名空間: System.ServiceModel.DomainServices.Server
組件: System.ServiceModel.DomainServices.Server (於 system.servicemodel.domainservices.server.dll)

使用方式

'用途
Dim instance As ExcludeAttribute

語法

'宣告
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple:=False, Inherited:=True)> _
Public NotInheritable Class ExcludeAttribute
    Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple=false, Inherited=true)] 
public sealed class ExcludeAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field, AllowMultiple=false, Inherited=true)] 
public ref class ExcludeAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple=false, Inherited=true) */ 
public final class ExcludeAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple=false, Inherited=true) 
public final class ExcludeAttribute extends Attribute

範例

下列範例示範套用至名為 rowguid 之屬性的 ExcludeAttribute,該屬性為 Guid 類型。

<MetadataTypeAttribute(GetType(Address.AddressMetadata))>  _
Partial Public Class Address
    
    Friend NotInheritable Class AddressMetadata
        
        'Metadata classes are not meant to be instantiated.
        Private Sub New()
            MyBase.New
        End Sub
        
        Public AddressID As Integer

        <Required()> _
        <StringLength(60)> _
        <RoundtripOriginal()> _
        Public AddressLine1 As String

        <RoundtripOriginal()> _
        Public AddressLine2 As String

        <Required()> _
        <StringLength(30)> _
        <RoundtripOriginal()> _
        Public City As String

        <RoundtripOriginal()> _
        Public CountryRegion As String
        
        Public CustomerAddresses As EntityCollection(Of CustomerAddress)

        <RoundtripOriginal()> _
        Public ModifiedDate As DateTime

        <Required()> _
        <RoundtripOriginal()> _
        Public PostalCode As String

        <Exclude()> _
        Public rowguid As Guid

        <RoundtripOriginal()> _
        Public StateProvince As String
    End Class
End Class
[MetadataTypeAttribute(typeof(Address.AddressMetadata))]
public partial class Address
{

    internal sealed class AddressMetadata
    {
        // Metadata classes are not meant to be instantiated.
        private AddressMetadata()
        {
        }

        public int AddressID { get; set; }

        [Required]
        [StringLength(60)]
        [RoundtripOriginal]
        public string AddressLine1 { get; set; }

        [RoundtripOriginal]
        public string AddressLine2 { get; set; }

        [Required]
        [StringLength(30)]
        [RoundtripOriginal]
        public string City { get; set; }

        [RoundtripOriginal]
        public string CountryRegion { get; set; }

        public EntityCollection<CustomerAddress> CustomerAddresses { get; set; }

        [RoundtripOriginal]
        public DateTime ModifiedDate { get; set; }

        [Required]
        [RoundtripOriginal]
        public string PostalCode { get; set; }

        [Exclude]
        public Guid rowguid { get; set; }

        [RoundtripOriginal]
        public string StateProvince { get; set; }
    }
}

備註

如果您不想要提供屬性 (Property) 讓用戶端應用程式使用,可將 ExcludeAttribute 屬性 (Attribute) 套用至該屬性 (Property)。許多值 (像是識別值) 是在資料來源中管理,而且不需要在用戶端中顯示或編輯。

繼承階層

System.Object
   System.Attribute
    System.ServiceModel.DomainServices.Server.ExcludeAttribute

執行緒安全性

任何這個類型的公用靜態 (在 Visual Basic 中為 共用) 成員都具備執行緒安全。 不保證任何執行個體成員安全執行緒。

平台

開發平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 、Windows Server 2008 和 Windows 2000

目標平台

Change History

另請參閱

參考

ExcludeAttribute 成員
System.ServiceModel.DomainServices.Server 命名空間