Last post Jul 28, 2018 11:37 AM by DA924
Jul 27, 2018 05:37 PM|pavanlalit|LINK
I am rewriting my legacy ASP.NET Web FOrms app to Angular 2. I am wondering if I need to use POCO objects and not sure how and why to use them. Do I really need them or how do I know if I have to use them any real world example would be helpful to understand
me better. I couldn't find many over the web.
Jul 27, 2018 09:29 PM|DA924|LINK
Jul 27, 2018 10:21 PM|pavanlalit|LINK
Hi DA 924,
we are using latesdt opensource front end frameworks to migrate our apps. So we chose Angular 2. So, I am restructring the wole App into UI layer (Angular), WebAPI (Service), BLL and DAL.
Thats when I am wondering if I need to use Plan Old CLR objects to represent data in database or just stick with edmx classes that were generated by Visual studio. Hope it made some better context
Jul 27, 2018 10:30 PM|mgebhard|LINK
It's not recommended to serialize EDMX types regardless of the client or server framework.
Jul 28, 2018 11:37 AM|DA924|LINK
The POCO is not meant for traveling between processes or layers. The DTO is meant for that.
The DAL is using the DAO pattern, DTO pattern and DAO doing CRUD with the database using EF. The DTO(s) are in a classlib project and all projects that need to know about the DTO(s) set project refernce to the Entities classlib project.
public class ProjectController : ControllerBase, IProjectController
private readonly IDaoProject _daoProject;
public ProjectController(IDaoProject daoProject)
_daoProject = daoProject;
public DtoProject GetProjectById(int id)
public List<DtoProject> GetProjectsByUserId(string userid)
public void Post_CreateProject(DtoProject dto)
public void Post_DeleteProject(int id)
public void Post_UpdateProject(DtoProject dto)