none
How do you map POCO objects to Entity Framework Conceptual Model from a 3.5 Framework Application ? RRS feed

  • Question

  • Is it true that the 3.5 Framework does not suport POCO layer ? And that support for it was only introduced in 4.0 ? ? How would you hydrate a POCO layer from Entity Framework in a 3.5 Framework application ? I found an attribute in 3.5:

    [

    assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()] Intellisense says it is used to indicate that an assembly contains classes that map to conceptual model of an Entity fRamework model. If POCO is not supported in 3.5 what is this attribute for? any guidance would be greatly appreciate. Thank you
    Tuesday, August 13, 2013 4:13 PM

Answers

  • Hello,

    Welcome to MSDN forum.

    Base on your description,In Entity Framework 4.0 ,POCO  Support was introduced directly.  wherea In 3.5 Framework ,POCO  Support was not introduced directly.  In Entity Framework 3.5 (.NET 3.5 SP1), there are more than a few restrictions that were imposed on entity classes. Entity classes in EF needed to either be sub classes of EntityObject, or had to implement a set of interfaces we collectively refer to as IPOCO – i.e. IEntityWithKey, IEntityWithChangeTracker and IEntityWithRelationships. These restrictions made it difficult if not downright impossible to build EF friendly domain classes that were truly independent of persistence concerns. It also meant that the testability of the domain classes was severely compromised.

    All of this changes dramatically with the next release of Entity Framework: 4.0 (.NET Framework 4.0). Entity Framework 4.0 introduces support for Plain Old CLR Objects, or POCO types that do not need to comply with any of the following restrictions: 

    • Inheriting from a base class that is required for persistence concerns
    • Implementing an interface that is required for persistence concerns
    • The need for metadata or mapping attributes on type members

    In addition, you can refer this link:

    http://social.msdn.microsoft.com/Forums/en-US/a991c20f-d195-43c3-a014-5033e3cc6624/is-there-anything-similar-to-poco-in-35

    Hope these help.


    Lilia Gong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, August 14, 2013 5:05 AM
    Moderator