.NET Api Setup
Hello all,
I just need advice in the setup of my .net project.
I was making it using the typical Unit of work (Repository) architecture where you have a unit of work & services that call unit of work which has a bunch of classes that are repositories.
Anyway, a week ago, someone here advised that because i am using EntityFramework, Unit of work is a bad practice, or not recommended.
So I decided to get rid of unit of work & services. And inject the IRepository class in my apis.
Program.cs:
And this is the repository, i am not declaring dbcontext, it's injected as well
user controller:
This works fine but
Question is, in unit of work, i had to dispose the context
do i need to do that here
I just need advice in the setup of my .net project.
I was making it using the typical Unit of work (Repository) architecture where you have a unit of work & services that call unit of work which has a bunch of classes that are repositories.
Anyway, a week ago, someone here advised that because i am using EntityFramework, Unit of work is a bad practice, or not recommended.
So I decided to get rid of unit of work & services. And inject the IRepository class in my apis.
Program.cs:
And this is the repository, i am not declaring dbcontext, it's injected as well
user controller:
This works fine but
Question is, in unit of work, i had to dispose the context
do i need to do that here