I am trying to write a dynamic lambda or query but it occurs an error..
for lambda; I created a function
public IEnumerable<musteriler> GetCustomers<musteriler>(Expression<Func<musteriler, bool>> where)
{
IEnumerable<musteriler> _musteriler = market.musteriler.Where(where).Select(m => m);
return _musteriler;
}
and I call like that
IEnumerable<musteriler> _musteriler = helper.GetCustomers<musteriler>(m => m.MAktif == true);
I get two errors in Where(where) which are
The best overloaded method match for System.Data.Objects.ObjectQuery<AkilliMarket.musteriler>.Where(string, params System.Data.Objects.ObjectParameter[])' has some invalid arguments
and
Argument 1: cannot convert from 'System.Linq.Expressions.Expression<System.Func<musteriler,bool>>' to 'string'
after I tried a string query like
IEnumerable<musteriler> _musteriler= market.musteriler.Where("MAktif = true").Select(m => m) as IEnumerable<musteriler>;
yes it works but I cant use _musteriler.. for example when I write _musteriler.Count(); I get this error
'MAktif' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly. Near simple identifier, line 6, column 1.
MAktif is a column name of my musteriler table in db. and I tried another columns but result is same..
Where are my mistakes for both?