Public class testList
{
Public string name {get; The set; }
Public string code {get; The set; }
}
I want to go to the database to find and match the name and code line
Written
The db. The where (m=& gt; TestList. The contains (new {m.n ame, m.c ode}))
Or
The db. The where (m=& gt; TestList. Any (any)=& gt; Any. Name==m.n ame& & Any. Code==m.c ode))
EF will be thrown cannot translate exceptions
I now is
Var queryList=db. The where (m=& gt; M. estList. Select (s=& gt; S.n ame). The contains (ame) & amp; & M. estList. Select (s=& gt; S.c ode). The contains (m.c ode)) toList ();
Var result=queryList. Where (m=& gt; TestList. The contains (new {m.n ame, m.c ode}))
Twice in the screening, the feeling is very low efficiency
Want to have a query on the database should be how to write
CodePudding user response:
Db. AsEnumerable (). The where (m=& gt; TestList. Any (any)=& gt; Any. Name==m.n ame& & Any. Code==m.c ode))But the table data time will slow
CodePudding user response:
try this?The db. The where (m=& gt; TestList. Select (p=& gt; P.n ame + p.c ode). The Contains (ame + m.c ode))
CodePudding user response: