Bordin
.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
106 replies
SignalR
Hi, I am trying to create a Notification feature for my application and I figured it should be Real-time. Which is why i am trying to use SignalR but i don't quite understand it.
I made a notification hub
So, i really dont understand what a hub is and i have read and asked chatgpt but i can't figure it out. What's a user? what's a message? how does it know who the client is? i really dont understand anything
I added the hub in program.cs btw so that step is done. I just dont know how that is supposed to send notifications because apparently it shouldn't return anything.
10 replies
✅ file path not saving properly with id
I am creating a file with path Uploads/companyId.png
However. The companyId is 0 because i am creating newCompany after i create the path. And if i created it before it saves as Microsoft.AspNetCore.http... And i guess that's because i created the company with no path.
any idea how i can fix this? its so confusing
10 replies