EFCore and multiple schemas RRS feed

  • Question

  • Good afternoon

    I have created a .net core console app am using EFCore.  When submitting for DBA review our DBAs want me to split out some staging tables from the main tables into its own schema.  I would then have 2 schemas as opposed to 1.  I was building a single context using scaffolding and am not sure how to proceed if I even can.  I am fairly new to EF and EF Core and there has been a lack of insight on this matter that I have found online.   Is this possible and if so can I do this in one context?  


    Tuesday, June 9, 2020 10:02 PM


  • Hello,

    You can have multiple DbContext in the same project via scaffolding/reverse engineering (if using SQL-Server check out this extension). If in the same project such as a class project depending on relationships use one namespace or multiple namespaces and organize in folders e.g.

    Part of the extension reverse engineer tool mentioned above.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    • Marked as answer by Cheesebread Wednesday, June 10, 2020 1:58 AM
    Wednesday, June 10, 2020 1:48 AM