0

For example I have table like this

Table
ID -- CategotyID -- ProductName
1 --------- 4 ----------Coca-Cola
2 --------- 7 ----------Tea
3 --------- 4 ----------Sprite

When I write in entityframework this code:
var list= db.Table.Where(w => w.CategotyID == 4).ToList();
list.ForEach(update => update.ProductName = "Fanta");
db.SaveChanges()
I saw in SQL Profiler executes this statement separately like this
update Table set ProductName = "Fanta" where ID = 1
update Table set ProductName = "Fanta" where ID = 3

How can I write from SQL to EntityFrameWork this statement?
update Table set ProductName = "Fanta" where CategoryID = 4


Don't wont to SQL Server executes it separately

1
  • Entity Framework doesn't support this, but luckily, as the answers to that other question show, the main work to allow it anyway has already been done by others.
    – user743382
    Commented Sep 26, 2013 at 18:17

1 Answer 1

1

I am not sure but I think you can't do with. Entity Framework is doing this under the hood.

Maybe you can try it with LINGQ to SQL.

http://www.codeproject.com/Articles/26657/Simple-LINQ-to-SQL-in-C

Not the answer you're looking for? Browse other questions tagged or ask your own question.