EF4 - entitySetName枚举或列表 [英] EF4 - entitySetName enum or list
问题描述
Hy,
我在字符串中遇到EntitySetName问题。如果实体名称发生变化,编译将会正常,但会抛出异常。
在.net 3.5中,我手动编写了一个包含所有EntitySetName的枚举,并使用了
myEnum.anEntitySetName.ToString()
您好,
在ObjectContext上您可以使用CreateObjectSet< ; T>()以避免需要实体集名称。在CTP4中,我们在ObjectContext(DbContext)上引入了一个简化的抽象,它假设类型和实体集是1:1,因此不会暴露实体集的概念
。
〜罗文</ p>
Hy,
I have a problem with EntitySetName in a string. If an entity name change, the compilation will be OK, but an exception will be thrown.
In .net 3.5, I coded manually an enum wich contains all EntitySetName, and used
myEnum.anEntitySetName.ToString()
Hi,
On ObjectContext you can use CreateObjectSet<T>() to avoid needing entity set names. In CTP4 we introduced a simplified abstraction over ObjectContext (DbContext) that assumes types and entity sets are 1:1 and therefore does not expose the concept of an entity set.
~Rowan
这篇关于EF4 - entitySetName枚举或列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!