entity framework - update foreign key after primary key creation -


i have following scenario (simplified) using linq ef 3.5

var datarepos = new entities();  var query = product in datarepos.products group product product.categoryid agg select new         {             category = agg.key,             sumtotal = agg.sum(x => x.unitprice)         };  foreach (var row in query)     {            var newpos = new summary()         {            category = row.category,            total = row.sumtotal         };     } 

the summary class represents database table , each time row added table’s primary key increments. need update relevant rows in products table newly generated id summary table i.e. update foreign key (which has default value of zero).

the number of rows involved significant. best approach here in terms of efficiency?


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -