다음을 통해 공유


IgnoreAttribute 클래스

DomainService의 메서드가 도메인 작업이 아님을 지정합니다.

네임스페이스: System.ServiceModel.DomainServices.Server
어셈블리: system.servicemodel.domainservices.server.dll의 System.ServiceModel.DomainServices.Server

사용법

‘사용 방법
Dim instance As IgnoreAttribute

구문

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

예제

다음 예제에서는 도메인 작업에 의해 호출되지만 도메인 작업으로 노출되지는 않는 도메인 서비스의 메서드를 보여 줍니다.

Public Sub InsertCustomer(ByVal customer As Customer)
    If (customer.SalesPerson = String.Empty) Then
        customer.SalesPerson = RetrieveSalesPersonForCompany(customer.CompanyName)
    End If

    If ((customer.EntityState = EntityState.Detached) _
                = False) Then
        Me.ObjectContext.ObjectStateManager.ChangeObjectState(customer, EntityState.Added)
    Else
        Me.ObjectContext.Customers.AddObject(customer)
    End If
End Sub

<Ignore()> _
Public Function RetrieveSalesPersonForCompany(ByVal companyname As String) As String
    Dim salesPersonToAssign As String = "unassigned"

    Dim customers As List(Of Customer)
    customers = GetCustomers().Where(Function(c) c.CompanyName = companyname).ToList()

    If (customers.Count > 0) Then
        salesPersonToAssign = customers.First().SalesPerson
    End If

    Return salesPersonToAssign
End Function
public void InsertCustomer(Customer customer)
{
    if (customer.SalesPerson == String.Empty)
    {
        customer.SalesPerson = RetrieveSalesPersonForCompany(customer.CompanyName);
    }

    if ((customer.EntityState != EntityState.Detached))
    {
        this.ObjectContext.ObjectStateManager.ChangeObjectState(customer, EntityState.Added);
    }
    else
    {
        this.ObjectContext.Customers.AddObject(customer);
    }
}

[Ignore]
public string RetrieveSalesPersonForCompany(string companyname)
{
    string salesPersonToAssign = "unassigned";

    List<Customer> customers = GetCustomers().Where(c => c.CompanyName == companyname).ToList();
    if (customers.Count > 0)
    {
        salesPersonToAssign = customers.First().SalesPerson;
    }

    return salesPersonToAssign;
}

설명

IgnoreAttribute 특성은 도메인 서비스의 메서드가 도메인 작업으로 노출되지 않았는지 확인하기 위해 사용합니다.

상속 계층

System.Object
   System.Attribute
    System.ServiceModel.DomainServices.Server.IgnoreAttribute

스레드 보안

이 형식의 모든 public static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 모든 인스턴스 멤버는 스레드로부터 안전하지 않을 수 있습니다.

플랫폼

개발 플랫폼

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008 및 Windows 2000

대상 플랫폼

Change History

참고 항목

참조

IgnoreAttribute 멤버
System.ServiceModel.DomainServices.Server 네임스페이스