Mixing EntityFramework ForEachAsync with using keyword

26 במרץ 2014

I just encountered an interesting question on Microsoft Web Developer forum What is the problem with below code? static void Main(string args) { RunAsyncEF(); Console.ReadKey(); } static void RunAsyncEF() { using (MyContext context = new MyContext()) { context.Products.ForEachAsync(p => { Console.WriteLine(p.Name); }); } } Surprisingly nothing is written to the Console window and no error is reported at run time My...
no comments