ExternalReferenceAttribute 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.]

Indicates that an association references entities belonging to an external DomainContext.

Inheritance Hierarchy


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


<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := False,  _
    Inherited := True)> _
Public NotInheritable Class ExternalReferenceAttribute _
    Inherits Attribute
Dim instance As ExternalReferenceAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, 
    Inherited = true)]
public sealed class ExternalReferenceAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field, AllowMultiple = false, 
    Inherited = true)]
public ref class ExternalReferenceAttribute sealed : public Attribute
[<AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, 
    Inherited = true)>]
type ExternalReferenceAttribute =  
        inherit Attribute
public final class ExternalReferenceAttribute extends Attribute

The ExternalReferenceAttribute type exposes the following members.


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



  Name Description
Public property TypeId (Inherited from Attribute.)



  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.)


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.)



When applied to an entity association member, this attribute indicates that the framework should not create a corresponding EntitySet in the generated client-side code. Consumers of the client-side property will need to add a DomainContext reference to the appropriate DomainContext containing the external entity type.

For a complete example, see Walkthrough: Sharing Entities between Multiple Domain Services.


The following example shows an ExternalReference attribute applied to a member that defines a related entity from another domain service.

Imports System.ServiceModel.DomainServices
Imports System.ComponentModel.DataAnnotations

Partial Public Class SalesOrderHeader
    <ExternalReference()> _
    <Association("Sales_Customer", "CustomerID", "CustomerID")> _
    Public Property Customer() As Customer

End Class
using System;
using System.ServiceModel.DomainServices;
using System.ComponentModel.DataAnnotations;

namespace SharedEntityExample.Web
    public partial class SalesOrderHeader
        [Association("Sales_Customer", "CustomerID", "CustomerID")]
        public Customer Customer { get; set; }

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


System.ServiceModel.DomainServices Namespace

Other Resources

Walkthrough: Sharing Entities between Multiple Domain Services