if your membership tables are in a different database than your domain tables, then you cannot use one DbContext in EF. What you can do here is that you can create two contexts, for example SecurityContext and DomainContext for each of these databases. But you will not be able to query by attaching objects that are in each of these contexts, and both contexts will not use the same transaction when updating the database (i.e. Not one unit of work).
I suggest you create these membership tables in your database instead of two databases. Then you can use one DbContext here (or event 2 if they are completely independent). Here, if you have correctly modeled all tables, columns, and relationships, you can generate a complete database using EF. But if I remember SqlMembershipProvider correctly, use stored procedures. If so, it will be difficult for you to create the entire database.
If you can provide more information, itβs easier to give a more specific solution.
source share