Home > Net > EF beginners, get some data in the table, why do you want to select the first
EF beginners, get some data in the table, why do you want to select the first
Time:10-04
I am a novice, the day before yesterday just started watching EF framework And found that, in many conditions to get a table of data in time (of course there are many ways), we will use Using (var context=new... ()) { Var users=form u in context. The users select u; If (the name! The users=="") users. The Where (... ); If (tel! The users=="") users. The Where (... ); }
Why, I wonder, I search for example, are Var users=form u in context. The users select u;
I direct Var users=context. The users; Then call If (the name! The users=="") users. The Where (... ); If (tel! The users=="") users. The Where (... ); Also can get the result, tracking execution of SQL, also does not have a full table query, is generated automatically with the where condition of T - SQL statement
For example, that are var users=form u in context. The users select u? Personally, I doubt whether need so written before, in 2017 the EF6.0, Microsoft optimized the grammar? Also please instruct the prawns
CodePudding user response:
Linq query syntax and method syntax
CodePudding user response:
The top of a roof, prawns ha haven't class
CodePudding user response:
For example, that are var users=form u in context. The users select u? Personally, I doubt whether need so written before, in 2017 the EF6.0, Microsoft optimized the grammar? - "two grammatical ways, according to the personal code used to that, as to why select this is grammar rules, no matter which way, eventually into Sql statements,
CodePudding user response:
First, the lambda method is used, linq, is the language of words
CodePudding user response:
Why use linq, because many table joint query lambda is hard to write and read,