locked
How to consume edmx from a seperate dll in a asp .net mvc application RRS feed

  • Question

  • Hi,

    I am having my edmx in a separate dll say DAL.

    I have a ASP .NET MVC 3.0 project and want to consume the edmx into my models.

    Do I have to create separate POCO classes as models and then map them to edmx entities

    or

    Use the edmx entities directly as model class in my MVC project?  examples will be helpful

    Thanks

    -Harsha

    Tuesday, July 3, 2012 5:24 AM

Answers

  • On 7/3/2012 1:24 AM, Harsharkr wrote:
    > Hi,
    >
    > I am having my edmx in a separate dll say DAL.
    >
    > I have a ASP .NET MVC 3.0 project and want to consume the edmx into my
    > models.
    >
    > Do I have to create separate POCO classes as models and then map them to
    > edmx entities
    >
    > or
    >
    > Use the edmx entities directly as model class in my MVC project?
    > examples will be helpful
    >
     
    Most leave the entities at the DAL, map them over to DTO(s) and send the
    DTO(s) through the tiers. I consider a POCO to be no more than a
    glorified DTO.
     
     
    namespace DAL.DTO
    {
        public class DTOArticle
        {
            public int ArticleID { get; set; }
            public string Tille { get; set; }
            public string Body { get; set; }
            public int? AuthorID { get; set; }
        }
    }
     
    There is an entity on the EF Model called Article, the Article entity is
    mapped to DTOArticle,  the DTO is sent to the client through the tiers,
    the client sends the DTO back to the DAL where it is mapped back to
    Article on the Model for CRUD (Create, Read, Update and Delete)
    operations against the database.
     
     
    • Marked as answer by Allen_MSDN Monday, July 9, 2012 2:27 AM
    Tuesday, July 3, 2012 8:09 AM