Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Add a dbcontext to a custom module #8711


User avatar
0
ashjackson created

Hi There,

I have successfully created my own custom modules (core, shared, application etc) to hold my own code, so that all code I write is kept in separate modules and separate .net projects from the supplied Zero code - However, the 1 area I can't seem to work out from the documentation is can I add a second DBContext for my entities so this too can be kept separate from the supplied code in it's own module?

I will use the same connection string, but in my context will specify a schema name so SQL Server will treat my context as a separate DB in the same file.

Thankyou in advance for your guidance.

AJ.


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can look at these examples.

    https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1476#issuecomment-277330004 https://github.com/aspnetboilerplate/modular-todo-app

    https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo