次の方法で共有


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

スレッド セーフ

この型の public static (Visual Basic では Shared) メンバーは、スレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

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