25 Haziran 2012 Pazartesi

codefirst inheritance strategies

I am in the .net world  for a while and bumped into several technical problems so far. I plan to post the problems with their solutions when i have time for this. I also want to write a post comparing .net and java platforms. For now, it is enough to state that i am a java fan..

http://romiller.com/2010/09/29/ef-ctp4-tips-tricks-code-first-inheritance-mapping/  is an article about how codefirst handles inheritance during table generation. To sum up, default table generation strategy is Table-per-Hierarchy (TPH) which keeps all data in one table created for the base type and automatically creates a Discriminator field in order ro discriminate different types. Table-per-Type (TPT) creates a table for the base type with shared columns and different tables for each derived type whereas Table-per-Concrete Class(TPC) creates an entirely different table for each class.. However, when the table generation strategy is modified, previously working code may start to blow up.. Moreover, performance is best when the default strategy (TPH) is used: http://blogs.msdn.com/b/adonet/archive/2010/08/17/performance-considerations-when-using-tpt-table-per-type-inheritance-in-the-entity-framework.aspx

Hiç yorum yok:

Yorum Gönder