EntityConnection.GetMetadataWorkspace 方法

定义

重要

此 API 不符合 CLS。

返回与此 MetadataWorkspace 关联的 EntityConnectionReturns the MetadataWorkspace associated with this EntityConnection.

public:
 System::Data::Metadata::Edm::MetadataWorkspace ^ GetMetadataWorkspace();
public System.Data.Metadata.Edm.MetadataWorkspace GetMetadataWorkspace ();
[System.CLSCompliant(false)]
public System.Data.Metadata.Edm.MetadataWorkspace GetMetadataWorkspace ();
member this.GetMetadataWorkspace : unit -> System.Data.Metadata.Edm.MetadataWorkspace
[<System.CLSCompliant(false)>]
member this.GetMetadataWorkspace : unit -> System.Data.Metadata.Edm.MetadataWorkspace
Public Function GetMetadataWorkspace () As MetadataWorkspace

返回

MetadataWorkspace

与此 MetadataWorkspace 关联的 EntityConnectionThe MetadataWorkspace associated with this EntityConnection.

属性

例外

内联连接字符串包含一个无效的 Metadata 关键字值。The inline connection string contains an invalid Metadata keyword value.

注解

创建 MetadataWorkspace 类时,将自动创建 EntityConnectionA MetadataWorkspace is automatically created when the EntityConnection class is created. 创建过程可能引发特定元数据异常。The creation process might throw metadata-specific exceptions. 元数据将被加载到内存中,Entity Data Model (EDM) 应用程序则使用该元数据访问有关基础数据源的信息。Metadata is loaded into memory and an Entity Data Model (EDM) application uses that metadata to access information about the underlying data source. 有关详细信息,请参阅 ADO.NET MetadataFor more information, see ADO.NET Metadata.

为了避免无意使对象(如 System.Data.Common.CommandTreesObjectContext)与其元数据失去同步,EntityConnection 必须锁定对象的元数据。To avoid inadvertently putting objects such as System.Data.Common.CommandTrees and ObjectContext out of sync with their metadata, EntityConnection must lock its metadata. 锁定元数据后,不允许对连接字符串做出任何更改。No changes to the connection string are allowed after the metadata is locked. 下面是锁定元数据的两种方案:The following are two scenarios in which metadata is locked:

加载元数据后,EntityConnection 验证概念性模型、存储模型和映射文件是否全部存在。When metadata is loaded, the EntityConnection verifies that the conceptual model, the storage model, and the mapping file are all present.

适用于