c# - Expression<Func<T1, T2, TResult>> and Sql IN -


i want use expression trees make filters entity framework.

so types

public class type1 {     public string name { get; set; } }  public class type2 {     public ienumerable<string> names { get; set; } } 

and specification

public expression<func<entities.type1, bool>> myexpression(type2 filter) {     //something name in (name[0], name[1], ... name[n]) } 

i need transform in sql in.

how can it, , what's best form?

how can make entity framework understand arbitrary expression in way want?

you can this:

public expression<func<type1, bool>> myexpression(type2 filter) {     return x => filter.names.contains(x.name); } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -