Comments (11)
from threenine.data.
Unfortunately at this moment in time, we have not implemented functionality to enable your requirement at present.
We do have the Dependency Injection at this moment to add multiple Db Contexts, but we have not implemented functionality within the repository layer to enable switching between them as of yet.
On our own projects we now try not to use this approach at all, primarily because we have preferred to use Microservice approach this solve this, so we have Microservices with their own databases and contexts to facilitate.
s
from threenine.data.
from threenine.data.
Sure no worries I will sort that out now
from threenine.data.
I was able to inject 2 units of work into the same service using the IUnitOfWork<ExampleContextA> and IUnitOfWork<ExampleContextB> and they both worked fine.
from threenine.data.
from threenine.data.
Hi Ratan
For now, I'm not changing any connectionstrings on the fly. During startup, I'm initializing my 2 DbContexts with something like this:
services.AddDbContext<CoreDbContext>(options => options.UseSqlServer(coreConnString)).AddUnitOfWork<CoreDbContext>();
services.AddDbContext<AuxDbContext>(options => options.UseSqlServer(auxConnString)).AddUnitOfWork<AuxDbContext>();
and then in a query handler in my data layer - separate from my biz layer - I'm injecting the UOW like this
private readonly IUnitOfWork<CoreDbContext> _coreUnitOfWork;
private readonly IUnitOfWork<AuxContext> _auxUnitOfWork;
I haven't noticed any issues with those UOWs yet - however, I'm still in kind of a proof-of-concept stage with this project.
I hope this helps. Would love to hear some feedback if you end up trying it.
@garywoodfine is there anything that seems wrong to you with this approach?
from threenine.data.
from threenine.data.
Related Issues (20)
- Readonly repository HOT 2
- GetList Order By HOT 1
- simple context HOT 3
- Need an example, how to inject dependency in Console App (.NET Core) HOT 2
- Provide example of Create, Update, Delete Api Examples. HOT 3
- provide sample for Projection & Including HOT 3
- Get All Items HOT 1
- Unable to cast object of type IRepositoryReadOnly, IRepository and IRepositoryAsync
- Implement Unit test Coverage
- cant find update method in Async Repository. HOT 1
- Use GetRepository and GetRepositoryAsync at same service throughs an exception HOT 3
- Write Documentation HOT 2
- Implement Readthedocs
- Create Product Page
- Inconsistent naming in SingleOrDefault vs FirstOrDefault HOT 6
- Use Myget for Dev package release
- Implement Split query functionality
- Functionality to get a single Item
- Provide Sample Applications
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from threenine.data.