c# - EF/LINQ : Find() operation -
i'm trying current user data row. but, when execute code
mndatacontext _db = new mndatacontext(); var nm = user.identity.name; var id = (int)membership.getuser(user.identity.name).provideruserkey; var slct = _db.utilisateurs.find((int)membership.getuser(user.identity.name).provideruserkey);
i'm getting null
value on var slct
line. weird because debugger indicates nm , id have right values last 1 isn't getting right object value.
mndatacontext class
public class mndatacontext: dbcontext { public dbset<utilisateurmodel> utilisateurs { get; set; } }
utilisateur's primary key:
[key] [databasegeneratedattribute(databasegeneratedoption.identity)] [display(name = "identifiant")] public int userid { get; set; }
any brilliant idea, please?
thanks lot!!
what happens when try this?
mndatacontext _db = new monitoringndatacontext(); var nm = user.identity.name; var id = (int)membership.getuser(user.identity.name).provideruserkey; utilisateurmodel slct = _db.utilisateurs.find(id);
is slct
still null? value id
have?
Comments
Post a Comment