MetadataWorkspaceExtensions 类

[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]

用于 MetadataWorkspace API 的扩展方法

继承层次结构

System.Object
  Microsoft.Data.Entity.Design.DatabaseGeneration.MetadataWorkspaceExtensions

命名空间:  Microsoft.Data.Entity.Design.DatabaseGeneration
程序集:  Microsoft.Data.Entity.Design.DatabaseGeneration(在 Microsoft.Data.Entity.Design.DatabaseGeneration.dll 中)

语法

声明
<ExtensionAttribute> _
Public NotInheritable Class MetadataWorkspaceExtensions
用法
public static class MetadataWorkspaceExtensions
[ExtensionAttribute]
public ref class MetadataWorkspaceExtensions abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type MetadataWorkspaceExtensions =  class end
public final class MetadataWorkspaceExtensions

MetadataWorkspaceExtensions 类型公开以下成员。

方法

  名称 描述
公共方法静态成员 GetAllAssociations 检索此 ItemCollection 中所有 AssociationType 元素的可枚举集合
公共方法静态成员 GetAllAssociationSets 检索此 ItemCollection 中所有 AssociationSet 元素的可枚举集合
公共方法静态成员 GetAllEntitySets 检索此 ItemCollection 中所有 EntitySet 元素的可枚举集合
公共方法静态成员 GetAllEntityTypes 检索此 ItemCollection 中所有 EntityType 元素的可枚举集合
公共方法静态成员 GetAllReferentialConstraints 检索此 SSDL/StoreItemCollection 中所有 ReferentialConstraints 的可枚举集合
公共方法静态成员 GetAssociation 返回 AssociationSet 中的关联
公共方法静态成员 GetContainingTypes 获取此 EntitySet 内的所有 EntityTypes
公共方法静态成员 GetDependentEnd 考虑到优先级顺序为 1 的以下规则,检索此关联的依赖端。如果存在针对关联定义的引用约束,将返回 DependentEnd。2.如果关联的多重性为 1:1 并且对第一个关联端定义了 OnDelete='Cascade',则返回另一个关联端。如果没有对第一个关联端定义 OnDelete='Cascade',则返回第一个关联端。3.在 1:* 或 0..1:* 关联中,这将返回以 * 多重性结尾的关联端。4.在 0..1:1 关联中,这将返回以 0..1 多重性结尾的关联端。
公共方法静态成员 GetDependentProperty 如果这是参与引用约束的主体端的属性,则此方法将返回依赖端上的相应属性。
公共方法静态成员 GetEnd1 返回指定 AssociationType 的 AssociationEndMembers 属性中的第一个 AssociationEndMember
公共方法静态成员 GetEnd2 返回指定 AssociationType 的 AssociationEndMembers 属性中的第二个 AssociationEndMember
公共方法静态成员 GetEntityContainerName 检索此 ItemCollection 中 &amp;lt;EntityContainer/&amp;gt; 元素的“Name”特性。
公共方法静态成员 GetEntityType 检索 AssociationEnd 上的 EntityType。
公共方法静态成员 GetKeyProperties(AssociationEndMember) 获取直接在 AssociationEnd 内的 EntityType 上声明的键属性
公共方法静态成员 GetKeyProperties(EntityType) 获取直接在 EntityType 上声明的键属性
公共方法静态成员 GetNamespace 通过检查首先找到的 StructuralType 检索此 ItemCollection 的命名空间
公共方法静态成员 GetOnDelete 这将获取 AssociationEnd 1 上 OnDelete 元素的值。如果该端和其同级端将“Cascade”指定为 2,将返回“None”。如果该端的多重性为 Many (*),将返回“None”
公共方法静态成员 GetOtherEnd 假定此关联的 AssociationEndMember,则此方法将返回参与关联的其他端
公共方法静态成员 GetPrincipalEnd 检索此关联的主体端
公共方法静态成员 GetRootOrSelf 在没有基类型时返回此 EntityType。否则,返回最顶层的基类型。
公共方法静态成员 GetSchemaName 为此 EntitySet 检索架构名称,存储在其 MetadataProperties 中
公共方法静态成员 GetStoreGeneratedPatternValue 在提供目标版本和 DataSpace 的情况下,获取 EdmProperty 的 StoreGeneratedPattern 值
公共方法静态成员 GetStoreType 通过 DbProviderManifest 从 EdmMember 的 EdmType 获取 StoreType
公共方法静态成员 GetTableName 为此 EntitySet 检索表名称,存储在其 MetadataProperties 中
公共方法静态成员 InferSsdlFacetsForCsdlProperty 从 CSDL 属性推断 SSDL 方面
公共方法静态成员 IsComplexProperty 确定此属性是否为 ComplexProperty;也就是说,其类型是否为 ComplexType
公共方法静态成员 IsDerivedType 确定指定实体类型是否为派生类型。
公共方法静态成员 IsJoinTable 如果为 :1 时,我们可推断某个表是 SSDL 中的连接表。有两个源自该表的关联 2.表上的两个端是 * 3.关联上的其他端是 1 4.表中的属性数等于两个关联的其他端上所有键属性的总和 5.表中的所有属性都为键属性
公共方法静态成员 IsManyToMany 确定某个关联的多重性是否为 *:*
公共方法静态成员 IsPKToPK 确定某个关联是否只跨主键
公共方法静态成员 ToStoreType 将某一 EDM 类型转换为 SQL 类型,并且考虑方面。请注意,在从 DbProviderManifest (FixedLength, Unicode) 获取某些方面时已考虑这些方面

顶部

线程安全

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

请参阅

参考

Microsoft.Data.Entity.Design.DatabaseGeneration 命名空间