locked
ADO.NET EF and POCO RRS feed

  • General discussion

  • We are developing an ASP.NET MVC 4 based business application which used ADO.NET EF 5.0. We do not want to expose the EF generated entities to the presentation or consumer. We want to define our business entities and translate to EF entities and vice versa. We looked at POCO approach which used t4 templates. We found this requires all the properties of EF entity should be defined in business entity model. This is not what we need.

    Are there any recommended patterns or framework to support our scenario? Please advice

    • Changed type Glenn CondronMicrosoft employee Thursday, August 30, 2012 4:03 PM I think htis is more of a discussion then a question, there is not likely to be a single answer
    Saturday, August 25, 2012 4:47 PM

All replies

  • Hi Arasheed,

    Welcome to the MSDN forum.

    I recommend you try to implement the repository and unit of work patterns. Please refer to this page to check if it is helpful for you: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application

    Good day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    Monday, August 27, 2012 2:55 AM
  • Hi,

    If you do go down the route of translating between entities and other objects to use in the rest of your app then you are going to end up needing a lot of mapping code.

    So an object-to-object mapping library is probably a good idea. Automapper (http://automapper.org/) is an example of one of these for .NET.


    We are seeing a lot of great Entity Framework questions (and answers) from the community on Stack Overflow. As a result, our team is going to spend more time reading and answering questions posted on Stack Overflow. We would encourage you to post questions on Stack Overflow using the entity-framework tag. We will also continue to monitor the Entity Framework forum.

    Monday, August 27, 2012 3:04 AM