Reputation: 649
I have the following method:
internal void DuplicateGroup(int oldGroupId, int newGroupId) {
IEnumerable<int> res = (from p in Db.table
where p.GroupID == oldGroupId
select p.packSizeID);
foreach (int ps in res)
Db.table.Add(new entityclass { GroupID = newGroupId, packSizeID = ps });
}
The method builds a List from desired IDs then adds new rescords to the same table with newGroupIDs. The question is: is it possible to call method within select?
Upvotes: 1
Views: 1240
Reputation: 21477
Not in that select no, but in some selects, yes. It depends on the data source. LINQ over EF, no, but LINQ over objects, yes.
Upvotes: 1