Home > Net >  Many conditions query
Many conditions query

Time:04-28

I am using asp.net + EF

Table structure
Id name sex...

Front desk has an input box, now need to enter more "space" as the separator name query conditions

Var aa=the from s in _context. Aa
Select the s;

Aa=aa. The Where (s=& gt; S.n ame. The Contains (searchString))


Originally a condition can be used directly to query the Contains

Now if the input/other, test users, this kind of condition, how to write this expression

CodePudding user response:

You can use dapper, pass as a parameter list

CodePudding user response:

EF linq best nested any way, because he is going to generate SQL statements, and once he resolution, will give you a full table, you must be aware of this!

Is you it's use in statement,

In statement is the Contains

String [] array=user input. The split (' ');

Var data=https://bbs.csdn.net/topics/_context.aa.where (a=> array. The Contains (a.n ame)). The tolist ();

CodePudding user response:

The worship the next 17 years bosses

CodePudding user response:

refer to the second floor nan peony reply:
EF linq don't nested any best way, because he is going to generate SQL statements, and once he resolution, will give you a full table, you must be aware of this!

Is you it's use in statement,

In statement is the Contains

String [] array=user input. The split (' ');

Var data=https://bbs.csdn.net/topics/_context.aa.where (a=> array. The Contains (a.n ame)). The tolist ();



With a string [] no, fuzzy query, haven't got a
  • Related