ExternalReferenceAttribute 类

指示关联引用属于外部 DomainContext 的实体。

命名空间: System.ServiceModel.DomainServices
程序集: System.ServiceModel.DomainServices.Client(在 system.servicemodel.domainservices.client.dll 中)

用法

用法
Dim instance As ExternalReferenceAttribute

语法

声明
<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

示例

下面的示例演示一个应用于定义其他域服务中的相关实体的成员的 ExternalReference 特性。

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

备注

应用于实体关联成员时,此特性指示框架不应在生成的客户端代码中创建对应的 EntitySet。客户端属性的使用者将需要添加对包含外部实体类型的相应 DomainContextDomainContext 引用。

有关完整示例,请参见Walkthrough: Sharing Entities between Multiple Domain Services

继承层次结构

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

线程安全

此类型的任何公共静态(在 Visual Basic 中为 共享)成员都是线程安全的。不保证所有实例成员都是线程安全的。

平台

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 、Windows Server 2008 和 Windows 2000

目标平台

Change History

另请参见

参考

ExternalReferenceAttribute 成员
System.ServiceModel.DomainServices 命名空间

其他资源

Walkthrough: Sharing Entities between Multiple Domain Services