Junction table with additional payload columns in EF4 CTP4 Code First -
i have following tables:
wopartlist (defines parts have 1 or more part_size) wopartsize (defines sizes have 1 or more part_size)
part_size (junction table addt payload columns such sku, on_hand etc...)
here poco classes dal:
// real world scenario: // partlist related part_size related partsize // // #8 stainless lag bolt sku- 87234018 size- 2 x 1/2 // on hand- 214 // on order- 12 // #8 stainless lag bolt sku- 87234199 size- 3 x 1/2 // on hand- 81 // on order- 18 // #10 stainless lag bolt sku- 87237835 size- 1 x 1/2 // on hand- 11 // on order- 14 // #10 stainless lag bolt sku- 87237835 size- 2 x 1/2 // on hand- 11 // on order- 14 // #10 stainless lag bolt sku- 87237835 size- 3 x 1/2 // on hand- 11 // on order- 14 // idea able create size once , use many times // many different parts... need keep specific statistics // each size of part... // how tell model part_size many-to-many junction table // between wopartsize , wopartslist ? public class wopartsize { public int wopartsizeid { get; set; } public datetime tadded { get; set; } public string size { get; set; } // nav collections public virtual icollection<part_size> parts { get; set; } } public class part_size // junction table { public int wopartsizemmid { get; set; } public string part_no { get; set; } public string part_descr { get; set; } public string sku { get; set; } public decimal cost_each { get; set; } public decimal price_each { get; set; } public int on_hand { get; set; } public int on_trucks { get; set; } public int on_order { get; set; } // put icollections<> here ? } public class wopartslist { public int wopartslistid { get; set; } public datetime tadded { get; set; } public string part_descr { get; set; } // nav references public virtual woparttype parttype { get; set; } public int woparttypeid { get; set; } public virtual icollection<part_size> sizes { get; set; } } how configure junction table ? annotations ? fluent api ? main trouble getting additional payload fields in junction table... otherwise let ef generate table me , have no poco class...
Comments
Post a Comment