CSLA 5 + Asp.Net Core API #2742
Replies: 3 comments 2 replies
-
I've read a lot of posts and SO threads about how to manage db connections with different connection strings within the context of DI (aspnetcore). The most consistent answer seems to be that people create different types for the different connection "types", and then request the needed type for injection. |
Beta Was this translation helpful? Give feedback.
-
Regarding the call to In CSLA 6 we did a better job, and the In CSLA 5 there's also an |
Beta Was this translation helpful? Give feedback.
-
Thank you for the answers! The problem with the dbContext is that it has to be added to the service collection at startup but how do you modify it when a new request comes in? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
We are starting up with CSLA 5 and have a database context that is created by giving the constructor the connection string.
We are using DI to inject it to the DAL and the context is used in every DataAccess method.
This now needs to be added to the service collection:
In the test program it is odone like this and that works:
But how is this done in ASP.Net Core API
This connection string should change on every session or request?
Where does the AddCsla come in?
Where should the db context be created?
Program.cs??
Beta Was this translation helpful? Give feedback.
All reactions