mercredi 8 juillet 2015

Repository pattern in Entity framework where clause

I want to get all users for specific role. I have write below query. But it gives me converstion error.

List<Expression<Func<AspNetUsers, object>>> include = new List<Expression<Func<AspNetUsers, object>>>();
Expression<Func<AspNetUsers, object>> roleInclude = (roles) => roles.AspNetRoles;
string roleName="Admin";
var users = Repository<AspNetUsers>.GetEntityListForQuery(r=>r.AspNetRoles.Where(y=>y.Name == roleName),null,include);

How to write these where clause?It gives me error that can not implecitly convert collection enumerator to bool

Aucun commentaire:

Enregistrer un commentaire