IgnoreAttribute Class

[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]

Specifies that a method on a DomainService is not a domain operation.

Inheritance Hierarchy

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

Namespace: System.ServiceModel.DomainServices.Server
Assembly: System.ServiceModel.DomainServices.Server (in System.ServiceModel.DomainServices.Server.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Method Or AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False,  _
    Inherited := True)> _
Public NotInheritable Class IgnoreAttribute _
    Inherits Attribute
'Usage
Dim instance As IgnoreAttribute
[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
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, 
    Inherited = true)>]
type IgnoreAttribute =  
    class
        inherit Attribute
    end
public final class IgnoreAttribute extends Attribute

The IgnoreAttribute type exposes the following members.

Constructors

Name Description
Public method IgnoreAttribute Initializes a new instance of the IgnoreAttribute class.

Top

Properties

Name Description
Public property TypeId (Inherited from Attribute.)

Top

Methods

Name Description
Public method Equals (Inherited from Attribute.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Attribute.)
Public method GetType (Inherited from Object.)
Public method IsDefaultAttribute (Inherited from Attribute.)
Public method Match (Inherited from Attribute.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ToString (Inherited from Object.)

Top

Explicit Interface Implementations

Name Description
Explicit interface implemetationPrivate method _Attribute.GetIDsOfNames (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.GetTypeInfo (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.GetTypeInfoCount (Inherited from Attribute.)
Explicit interface implemetationPrivate method _Attribute.Invoke (Inherited from Attribute.)

Top

Remarks

You use the IgnoreAttribute attribute to ensure that a method on a domain service is not exposed as a domain operation.

Examples

The following example shows a method in a domain service that is called by a domain operation, but is not exposed as a domain operation.

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;
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.ServiceModel.DomainServices.Server Namespace