EF Core in multi layer RRS feed

  • Question

  • Hi

    i have a AspNet Core 2.2 and i want to save data in my SqlServe DB using a DAL layer. I have a DB already created, so i have to use Database First (not Code First). CORE use EF CORE and in my software architecture, i have API rest ws (ServicesLayer) that call a BO library layer that cal DAL library that performs CRUD operations.

    About this, CORE use DI in Controller class (in ServicesLayer project), for create an istance of DbContext class that i can use for call CRUD operations. This is a problem for me, because i need this istance in DAL layer not in ServicesLayer; how can I have this istance in DAL layer without passing it as a parameter of Biz and Dal layer?


    Tuesday, May 7, 2019 9:50 AM