Differences between revisions 1 and 2
Revision 1 as of 2022-02-20 23:39:43
Size: 710
Editor: scot
Comment:
Revision 2 as of 2022-02-20 23:40:03
Size: 709
Editor: scot
Comment:
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
{{{#!hightlight sql {{{#!highlight sql

Console Database Example using EF Core 6

Major Caveat: EntityFrameworkCore does not support a simple many-to-many relationship (as of 2/20/2022) nor does it do what you would expect and include the intersection table. Instead it creates code that causes a runtime error.

Fix: The fix is weirder than you might expect. You must include the intersection table on your own. But you might ask, can't I make the entity framework core six include the table for me. Why yes, YES YOU CAN. But it will take a bit of changing of your database. For me this required the altering of a single table in our database.

   1 ALTER TABLE teaches
   2 ADD teacher_credit NUMERIC(3,12);

ProgrammingLinks/ConsoleDatabaseExampleEf6 (last edited 2024-03-25 17:29:16 by scot)