在运行时创建EDM?

在运行时创建EDM?

问题描述:

您好,我有一个关于ADO.NET实体框架的一般性问题,是否可以在运行时创建EDM。

我正在使用VS2010中的WCF RIA服务开发一个演示应用程序,并使用EF生成数据库模型。我的应用程序的一个要求是用户可以通过他们创建的UI模板创建新的数据库表。然后,这将生成新的数据库表或修改现有表中的列。

在这种情况下,我如何更新我的EDM以反映运行期间的这些变化,或者在这种情况下是否无法使用EF或RIA服务?

提前获得任何帮助。

维克多

Hello,

I have a general question about the ADO.NET entity framework and if it is possible to create a EDM during runtime.

I'm developing a demo app using WCF RIA Services in VS2010, and using the EF to generate a model of the database. One requirement of my app is that a user has the ability to create a new database table via a UI template they create. This will then generate a new database table or modify columns in an existing table.

In this case how would I update my EDM to reflect these changes during runtime, or is it not possible to use EF, or RIA services in this context?

Thanks in advance for any help you may have.

Victor

Hello Victor,

 

欢迎使用ADO.NET实体框架和LINQ to Entities论坛!

 

既然你正在使用VS2010,我建议你考虑一下新的功能EF4的res,仅限代码,仅使用代码生成EDM元数据。  有关仅限代码的详细信息和示例代码,请参阅:

Since you are using VS2010, I recommend you consider one of the new features of EF4, Code Only, to generate the EDM metadata with only codes.  For detailed information and sample codes about Code Only, please see:

 

仅限代码(实体框架设计博客)

http://blogs.msdn。 com / efdesign / archive / 2009/06 / 10 / code-only.aspx

http://blogs.msdn.com/efdesign/archive/2009/06/10/code-only.aspx

 

Code Only Enhancem ents(实体框架设计博客)

http://blogs.msdn.com/efdesign/archive/2009/08/03/code-only-enhancements.aspx

http://blogs.msdn.com/efdesign/archive/2009/08/03/code-only-enhancements.aspx

 

仅代码进一步增强(实体框架设计博客)

http://blogs.msdn.com/efdesign/archive/2009/10/12/code-only- Further-enhancements.aspx

http://blogs.msdn.com/efdesign/archive/2009/10/12/code-only-further-enhancements.aspx

 

功能CTP演练:仅针对实体框架的代码(更新)

http://blogs.msdn.com/adonet/pages/feature-ctp-walkthrough-code-only-for-the-entity-framework.aspx

http://blogs.msdn.com/adonet/pages/feature-ctp-walkthrough-code-only-for-the-entity-framework.aspx

 

使用此功能,我们可以使用 POCO类 在运行时生成EDM元数据。   但是,如果您的请求是动态创建EDM,则可能会更复杂,因为我们需要动态创建POCO类和生成EDM元数据的过程。   如果数据库是根据一些有限的选项创建的,那么它可以更容易,因为我们可以设计多个流程来通过仅代码生成EDM元数据。  

With this feature, we can use POCO classes to generate the EDM metadata during runtime.  However, if your request is to create the EDM dynamically, it could be more complicated because we need to dynamically create the POCO classes and the process to generate EDM metadata.   If the database is created according to some limited options, it can be easier since we can design several processes to generate the EDM metadata via Code Only.  

 

我不是RIA服务的专家。  但在客户端,我认为我们还需要POCO类来获取数据。  详情请参阅Silverlight论坛, WCF RIA服务    此外,对于EF4问题,我们可以在此处的预发布EF论坛进行咨询, http://social.msdn.microsoft.com/Forums/en-US/adonetefx/threads/    许多产品团队成员都在那里帮助我们。  

I am not an expert of RIA services.  But at the client side, I think we also need the POCO classes to get the data.  For detail, I suggest you consult at the Silverlight forum, WCF RIA Services.   Also, for EF4 issues, we can consult at the pre-release EF forum here, http://social.msdn.microsoft.com/Forums/en-US/adonetefx/threads/.   Many product team members are helping us there.  

 

 

度过美好的一天!

 

 

最诚挚的问候,郎灵芝

MSDN Su bscriber支持 在论坛

如果您对我们的支持有任何反馈,请联系 msdnmg@microsoft.com