IgnoreAttribute クラス
DomainService のメソッドは、ドメイン操作でないことを指定します。
名前空間: System.ServiceModel.DomainServices.Server
アセンブリ: System.ServiceModel.DomainServices.Server (system.servicemodel.domainservices.server.dll 内)
使用方法
'使用
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 名前空間