HomeCodeASP.Net CoreSpecifying Schema Names in Entity Framework Core Code-First Models Log in


Specifying Schema Names in Entity Framework Core Code-First Models — 3 Comments

    • Yes, the fluent API provides that method. I had not used Entity Framework for five years when I posted that. Back then I was trying, as much as possible, to use attributes rather than fluent because I find them easier to read, and because dividing the model definition across two files is somewhat inconvenient. Whatever works, though. Thank you.

      Now I have no choice but to use fluent API, because many of my primary keys are going composite as I migrate to a multi-tenant database, where the 2nd column of the PK is the customer ID, and as I configure EF Core 5 many-to-many navigation against my existing join tables. To maintain readability for the PKs, I add comments to the PK properties in the model class.

Leave a Reply

Your email address will not be published. Required fields are marked *

HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>