Net Core: Create Generic Repository Interface Id Mapping for All Tables Auto Code Generation

前端 未结 2 1003
小蘑菇
小蘑菇 2020-12-19 22:46

We just Scaffolded our database, and created Models from Database tables in Entity Framework.

Additionally, we are creating files with Ids which Map to the Primary K

2条回答
  •  一个人的身影
    2020-12-19 23:00

    I agree with @Ivan, I wouldn't recommend you this way, but you answered that you need to, so here we go.

    You're using EFCore right ? Luckily, EFCore is open-source, so we can dig into the source code and build custom EFCore versions.

    A few months ago I had also a specific need with EF Context scaffolding, we also have over 200 tables and needed to put mappings for each table in a separate class, because EF Core, defaults to put all the mapping stuff in the DbContext file and this generated a 10k+ lines of code long DbContext class for us

提交回复
热议问题