Entering the Linq to SQL pit, here also don't understand the things, want to ask next,
For example:
Private void Button_Click (object sender, RoutedEventArgs e)
{
DataClasses1DataContext dc new DataClasses1DataContext ();
Console. WriteLine (" dc. DeferredLoadingEnabled: {0} ", dc, DeferredLoadingEnabled);//print out here is true
Var qa=the from p in dc. Table1 select p;
Qa=qa. The Where (p=& gt; (p.t 1 & lt; 5));
ListConsole. WriteLine (" list. The Count: {0} ", a list, Count);
}
Database is the following:
In this example, my colleagues and I had different opinions:
opinion a : I said should be a lazy loading, to use the "qa. ToList ();" When do the SQL query, only a single SQL statement, select out 3 records,
opinion 2 : but different opinion is that in debug mode, the execution of the "var qa=the from p in dc. Table1 select p;" See the result view of qa, is 5 records, the following figure, so he said linq is all the records will be taken back to the memory, and then do the where condition selection,
Want to ask the above two kinds of opinions, which right? Best can tell me the principle of reason
Please help everybody to give directions under
Any opinions, code, links, data can be, welcome to provide the relevant material, first thanked everybody!!
CodePudding user response:
Debug mode to see the equivalent output as a result, you use SQL server profiler tool monitoring what time executing SQL statements have result, check whether there is a line by line debugging SQL statement generated is ok,CodePudding user response:
That I haven't seen, versus when you expand prompt "receive overtime?"
Thing is to see you, you want to see the somebody else will give you see, don't you point, Microsoft won't let you see, tip you "sorry boy, please tolist?"
CodePudding user response:
Which the official name of the called "visual debugger" - the goal is to make you see, for example you can extend an own Image visual debugger, can extend a json visual debugger (show jsonTree, for example, when you write json to have the tree, but the somebody else to show you, can take the tree display, you see only the somebody else want to show, isn't he in fact run)CodePudding user response:
Regardless of the opinions 1 or 2,As long as you go to see, when they are IQueryable
When they are IEnumerable
CodePudding user response:
Thank you for yourCodePudding user response:
https://blog.csdn.net/ma_jiang/article/details/53065809
This is the ans programmer to extend the vs bring visual editor, you see he post code, as XXXX of XXXX, namely is to tell you, this can edit internal code, the code to execute, so he is to show a linq, can go to the show as a result, of course can also be generated to show the expression tree (ps: this kind of display generated linq expression trees of the third party visual editor actually have long, just not too common, I already forgot to call what)
CodePudding user response: