What is the advantage of utilizing LINQ to SQL DataContext?

What is the advantage of utilizing LINQ to SQL DataContext? Or is there a problem that you do not have these DataContext objects?

For example, for easy coding, I could do something like ...

var list = from p in (new MyDataContext()).People where p.LastName.Contains("sommar") select p;

In this case, I am new to the instance, but have not “closed” it or destroyed it. Is it still where there are problems that may cause me problems? To continue the ante, let me put this in a loop where it is called 2000 times. <italian: accent> You are having a problem with this: </ italian: accent>

+3
source share
1 answer

L2S . , , , , 2000 . - , SQLConnection . 2000 . OTOH, , .

, , . .

+2

Source: https://habr.com/ru/post/1733269/


All Articles