简体   繁体   中英

Postgresql Table Inheritance in entity framework

I wonder if it is possible to do postgres table inheritance in entity framework 7 - instead of the addition of columns do a "real" postgres with base table and table that inherit base table?

If so, how do I configure that?

Cheers, Mario

This is definitely not supported. In theory you could create your database schema yourself with inheritance (so outside EFCore) and then mapping CLR entities to that, without EFCore knowing anything about the table inheritance. However, if the CLR classes themselves inherit from one another (as they should in general), that would likely trigger EFCore's own inheritance feature, which will mess everything up. If there's some way to tell EFCore to disregard the CLR inheritance you might be able to get away with it.

As for a more complete solution where EFCore is actually aware of PostgreSQL inheritance, that would probably be a pretty big task, which would probably involve changes in EFCore itself (and not just the Npgsql provider).

Can you please open an issue ? I definitely won't have any time to work on this anytime soon but it's good to have it in the list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM