[type here]()
How to Extend MainProjectDataContext & use it in RCL project?
Hamed Vaziri
136
Reputation points
Hi
I have a blazor server project as my main project with a configured dataContext called forexample : MainProjectDataContext.
Now i have a razor class library project which has a reference to my main blazor server project. in my rcl project i've added some classes as poco (without define any dataContext) to handle database transactions.
Now i have a some questions?
- How to extend my MainProjectDataContext in rcl project to handle database transactions for my new classes that i've created in my rcl project?
- how to add my new rcl dataContext to service providers & inject it into my razor files (with some options which i've configured in my main blazor server porject such as connectionString, ...)?
I will be grateful if you show with an example code.
Thanks in advance
2 answers
Sort by: Most helpful
-
Piyaphart Samutkang 0 Reputation points
2023-07-10T18:19:53.6033333+00:00 -
Bruce (SqlWork.com) 71,266 Reputation points
2023-07-10T20:18:57.41+00:00 .net does not allow circular references (two projects to ref each other). You should create third project for all shared code.