How to map Entity Framework model classes with Business Layer class in n-tier architecture - ASP.NET-MVC

后端 未结 3 1450
我在风中等你
我在风中等你 2021-02-10 03:13

I am working on e-tier architecture within MVC framework (ASP.NET MVC5, Entity Framework 6). My application is divided into three sub-projects which are Business-Layer, Data-Acc

3条回答
  •  眼角桃花
    2021-02-10 03:55

    You can simply do this by using AutoMapper Install it via Nuget:

    PM> Install-Package AutoMapper
    

    and then all you have to do is to config AutoMapper to map similar objects for you.

    Mapper.CreateMap();
    

    You can convert objects anywhere like this :

    BLL.User bll_User = Mapper.Map(dal_user);
    

提交回复
热议问题