EF4 - entitySetName enum or list RRS feed

  • Question

  • 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


    With EF4 and EF4 CTP4, we can use Include with lambda-expression wich is a good alternative. Does an aleternative exist for the ObjectContext.AddObject functionnality? And what about the others functionnalities which need an EntitySetName in string?

    Is it possible to generate this enum from the model ?

    Thanks in advance, best regards

    Wednesday, November 24, 2010 8:01 AM

All replies

  • 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.


    Thursday, November 25, 2010 12:40 AM