AssociationSet.Create 方法
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
从指定的参数创建一个只读 AssociationSet 实例。
命名空间: System.Data.Entity.Core.Metadata.Edm
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
Public Shared Function Create ( _
name As String, _
type As AssociationType, _
sourceSet As EntitySet, _
targetSet As EntitySet, _
metadataProperties As IEnumerable(Of MetadataProperty) _
) As AssociationSet
用法
Dim name As String
Dim type As AssociationType
Dim sourceSet As EntitySet
Dim targetSet As EntitySet
Dim metadataProperties As IEnumerable(Of MetadataProperty)
Dim returnValue As AssociationSet
returnValue = AssociationSet.Create(name, type, _
sourceSet, targetSet, metadataProperties)
public static AssociationSet Create(
string name,
AssociationType type,
EntitySet sourceSet,
EntitySet targetSet,
IEnumerable<MetadataProperty> metadataProperties
)
public:
static AssociationSet^ Create(
String^ name,
AssociationType^ type,
EntitySet^ sourceSet,
EntitySet^ targetSet,
IEnumerable<MetadataProperty^>^ metadataProperties
)
static member Create :
name:string *
type:AssociationType *
sourceSet:EntitySet *
targetSet:EntitySet *
metadataProperties:IEnumerable<MetadataProperty> -> AssociationSet
public static function Create(
name : String,
type : AssociationType,
sourceSet : EntitySet,
targetSet : EntitySet,
metadataProperties : IEnumerable<MetadataProperty>
) : AssociationSet
参数
- name
类型:System.String
关联集的名称。
- type
类型:System.Data.Entity.Core.Metadata.Edm.AssociationType
关联集中元素的关联类型。
- sourceSet
类型:System.Data.Entity.Core.Metadata.Edm.EntitySet
源关联集端的实体集。
- targetSet
类型:System.Data.Entity.Core.Metadata.Edm.EntitySet
目标关联集端的实体集。
- metadataProperties
类型:System.Collections.Generic.IEnumerable<MetadataProperty>
要与该实例相关联的元数据属性。
返回值
类型:System.Data.Entity.Core.Metadata.Edm.AssociationSet
新创建的 AssociationSet 实例。
异常
例外 | 条件 |
---|---|
ArgumentException | 指定的名称为 null 或空。 |
ArgumentNullException | 指定的关联类型为 null。 |
ArgumentException | 指定的关联类型的其中一端的实体类型与相应实体集端的实体类型不匹配。 |