I am trying to find an user that has a custom property "Token" that I added with database migration, I tried to use:
var adb = new AppDbContext();
var found = adb.Users.Where(u => u.Token == "ABDJ_SJ_ETC");//Error
//OR found = adb.Users.SingleOrDefault(); Error too
My AppDbContext class
AppDbContext.cs
namespace MyApp{
public class AppDbContext : IdentityDbContext<AppUser>{
public AppDbContext(): base("DefaultConnection"){}
}
}
AppUser.cs
namespace MyApp{
public class AppUser : IdentityUser{
public string Token {get;set;}
}
}
The error is "System.Data.Entity.IDbSet does not contain a definition for 'Where' and no extension method 'Where' accepting a first argument of type 'System.Data.Entity.IDbSet could be found (are you missing a using directive or an assembly reference?)
Without the Where line my app runs correctly, add Users to db with my Token, etc. What i need to do to find an AppUser by that custom field??
using System.Linq;