实体框架CTP 3可能的错误 [英] Entity Framework CTP 3 Possible Bug

查看:61
本文介绍了实体框架CTP 3可能的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ContextBuilder类,它是CTP 3软件包的一部分。 这是一段代码片段:

I'm using the ContextBuilder class, which is a part of the CTP 3 package.  Here's a code snippet:

var storeConnection = new SqlConnection(Connection);
_context = _builder.Create(storeConnection);

隐含的通用参数 属于ObjectContext类型。 当我尝试查看映射了哪些实体时,我看到了我的实体,但它们使用System.Data.Objects命名不正确。

The implied generic parameter is of type ObjectContext.  When I try to view which entities are mapped, I see my entities but they are incorrectly namespaced with System.Data.Objects.

var entities = context.MetadataWorkspace.GetItems<EntityType>(DataSpace.CSpace);

System.Data.Objects.Person,System.Data.Objects.Employee等。命名空间应为MyDomain.Person,MyDomain.Employee等等。

System.Data.Objects.Person, System.Data.Objects.Employee, etc. The namespace should be MyDomain.Person, MyDomain.Employee, etc.

有什么想法吗?

 

 

推荐答案

EDM中使用的命名空间取自派生的ObjectContext您与ContextBuilder一起使用。 如果您不使用派生的ObjectContext,那么命名空间默认为您看到的System.Data.Objects。 命名空间永远不会从实体类本身获取

The namespace used in the EDM is taken from the derived ObjectContext that you use with ContextBuilder.  If you don't use a derived ObjectContext, then the namespace defaults to System.Data.Objects as you have seen.  The namespace is never taken from the entity classes themselves.

EDM中命名空间的值以及我们在Code First中应该做些什么是我们一直在讨论的问题&NBSP;知道为什么EDM命名空间对您的应用程序来说很重要会很有趣吗? 换句话说,你的应用程序中使用这个命名空间的地方是否有

The value of the namespace in the EDM and what we should do about it in Code First is something we have been discussing.  It would be interesting to know why it matters what the EDM namespace is for your application?  In other words, are there places in your application where you are using this namespace?

谢谢,

Arthur

Thanks,
Arthur

 


这篇关于实体框架CTP 3可能的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆