i have 2 tables in database, t1 & t2. have created corresponding entities in e1 & e2. here e2 derived e1.
e1 mapped t1 table , e2 mapped t2 table. application reads e1 t1 table. but, create/update/delete operation, e1 cast e2 , supposed save t2. when ef tries save e2, tries save e2.base (i.e e1) t1 table. in case of update throws exception (violation of pk constraint) since there record entities identity in table t1.
the purpose of having table t2, have approval stage, once approved of changes in e2~t2 change shall reflected in t1 table.
also purpose of deriving e2 e1 because, e1 provides identities both tables t1 & t2 , therefore e2 specifies operation has been performed on e1 object.
if i'm not confusing enough, have @ this:
t1 (int id, varchar(50) name) t2 (int id, varchar(50) name, varchar(50) operation) [table("t1")] class e1 { [key]int id, string name} [table("t2")] class e2 : e1 {string operation}
so question is, when saving e2, how can have entity framework save t2 , not t1 ?