Learning about LINQ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 3 years ago. Improve this question Overview One of the things I’ve … Read more

LINQ-to-SQL vs stored procedures? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

Entity framework linq query Include() multiple children entities

This may be a really elementry question but whats a nice way to include multiple children entities when writing a query that spans THREE levels (or more)? i.e. I have 4 tables: Company, Employee, Employee_Car and Employee_Country Company has a 1:m relationship with Employee. Employee has a 1:m relationship with both Employee_Car and Employee_Country. If … Read more

Entity Framework: There is already an open DataReader associated with this Command

I am using Entity Framework and occasionally i will get this error. EntityCommandExecutionException {“There is already an open DataReader associated with this Command which must be closed first.”} at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands… Even though i am not doing any manual connection management. this error happens intermittently. code that triggers the error (shortened for ease of reading): if … Read more

LINQ equivalent of foreach for IEnumerable

I’d like to do the equivalent of the following in LINQ, but I can’t figure out how: IEnumerable<Item> items = GetItems(); items.ForEach(i => i.DoStuff()); What is the real syntax? 22 s 22 There is no ForEach extension for IEnumerable; only for List<T>. So you could do items.ToList().ForEach(i => i.DoStuff()); Alternatively, write your own ForEach extension … Read more