Condividi tramite


Classe ExternalReferenceAttribute

Indica che un'associazione fa riferimento a entità che appartengono a un oggetto DomainContext esterno.

Spazio dei nomi: System.ServiceModel.DomainServices
Assembly: System.ServiceModel.DomainServices.Client (in system.servicemodel.domainservices.client.dll)

Utilizzo

'Utilizzo
Dim instance As ExternalReferenceAttribute

Sintassi

'Dichiarazione
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple:=False, Inherited:=True)> _
Public NotInheritable Class ExternalReferenceAttribute
    Inherits Attribute
[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
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple=false, Inherited=true) */ 
public final class ExternalReferenceAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple=false, Inherited=true) 
public final class ExternalReferenceAttribute extends Attribute

Esempio

Nell'esempio seguente viene illustrato un attributo ExternalReference applicato a un membro che definisce un'entità correlata da un altro servizio del dominio.

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
    {
        [ExternalReference]
        [Association("Sales_Customer", "CustomerID", "CustomerID")]
        public Customer Customer { get; set; }
    }
}

Osservazioni

In caso di applicazione a un membro dell'associazione di entità, questo attributo indica che tramite il framework non deve essere creato un oggetto EntitySet corrispondente nel codice sul lato client generato. I consumer della proprietà sul lato client dovranno aggiungere un riferimento DomainContext all'oggetto DomainContext appropriato contenente il tipo di entità esterno.

Per un esempio completo, vedere Walkthrough: Sharing Entities between Multiple Domain Services.

Gerarchia di ereditarietà

System.Object
   System.Attribute
    System.ServiceModel.DomainServices.ExternalReferenceAttribute

Sicurezza dei thread

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. Non è invece garantita la sicurezza dei membri dell'istanza.

Piattaforme

Piattaforme di sviluppo

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

Piattaforme di destinazione

Change History

Vedere anche

Riferimento

Membri ExternalReferenceAttribute
Spazio dei nomi System.ServiceModel.DomainServices

Altre risorse

Walkthrough: Sharing Entities between Multiple Domain Services