© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
37 replies
KooriByte

✅ Where to declare relationships when you have two DBContexts?

Hi! I ended up with two DBContexts in my project (ApplicationDbContext and an IdentityDbContext)...

Now I have to do a many to many relationship between an object and a user, but I'm not sure how would this work. I declared the relationship in one DbContext, and the migration with this one worked (with a warning that I might lose data). If I try to do a Migration with the other Context, it screams to me an error that i know how to fix, but would imply in declaring this relationship two times, and I'm not sure if this is ok.

Has anyone here experienced this?? I would really appreciate some help, it is the first time I try to develop something without a tutorial and it is a bit overwhelming at times.

Tkss 😄
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Declare method using T and where [Answered]
C#CC# / help
4y ago
EF6 Relationships
C#CC# / help
2y ago
One-to-many relationships - EF
C#CC# / help
2y ago