Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a catalog database and a profile database #38

Open
Ratankalwa opened this issue Jul 29, 2021 · 11 comments
Open

I have a catalog database and a profile database #38

Ratankalwa opened this issue Jul 29, 2021 · 11 comments

Comments

@Ratankalwa
Copy link

I have a catalog database and a profile database, how to use your library to perform data manipulation on 2 databases/ is there a possibility to perform a transaction i.e. inserting data in catalog database and profile database.

I have tried to subscribe to your support,

It says Paypal INR Failure.

I look forward to hearing from you soon.

@garywoodfine
Copy link
Contributor

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

@Ratankalwa
Copy link
Author

Ratankalwa commented Jul 29, 2021 via email

@garywoodfine
Copy link
Contributor

Sure no worries I will sort that out now

@Ratankalwa
Copy link
Author

Ratankalwa commented Jul 29, 2021 via email

@cjabbour
Copy link

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.

@Ratankalwa
Copy link
Author

Ratankalwa commented Jan 26, 2022 via email

@cjabbour
Copy link

cjabbour commented Jan 27, 2022

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?

@Ratankalwa
Copy link
Author

Ratankalwa commented Jan 27, 2022 via email

@dapns
Copy link

dapns commented Jul 6, 2023

Hi @garywoodfine

I am getting an am error in .net core 6: The call is ambiguous between the following methods or properties.
when I am using factory pattern.
image

but the same code is working with repository pattern in .net core 3.1,
image

Could you please help me on it

@garywoodfine
Copy link
Contributor

I will have to take more of a detailed look into it later. At the moment I can't really see what the issue is.
Will report back in a couple of hours

@garywoodfine garywoodfine reopened this Jul 6, 2023
@dapns
Copy link

dapns commented Jul 6, 2023

I will have to take more of a detailed look into it later. At the moment I can't really see what the issue is. Will report back in a couple of hours

Table Model Example:
image

Please help me on this, I am waiting for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants