0

I'm currently writing a handy ticketsystem where tickets can be moved to an archive. The ticket entity has many properties and associations to other entities and if I'm right I could just draw an inheritance that inherits all those props and assoc. to an archive entity (see image).

entity framework inheritance

If my thought is correct I have no idea how to move an entry to the archive in code because I have no clue how to access this inherited archive... pseudocode that's not working

4

1 回答 1

1

Derived entities are part of the collections of their base entities.

To access the first derived entity, you can write

db.TicketSet.OfType<Archive>().First()

To add a derived entity, simply add it to the base collection.

于 2013-02-11T22:49:58.537 回答