c# - Why can't I access the Database property of an IdentityDbContext? -
i have identitydbcontext declared as:
public class appcontext : identitydbcontext<appuser, approle, guid, appuserlogin, appuserrole, appuserclaim> { ... } identitydbcontext extends dbcontext , declaration looks like:
public class identitydbcontext<tuser, trole, tkey, tuserlogin, tuserrole, tuserclaim> : dbcontext tuser : microsoft.aspnet.identity.entityframework.identityuser<tkey, tuserlogin, tuserrole, tuserclaim> trole : microsoft.aspnet.identity.entityframework.identityrole<tkey, tuserrole> tuserlogin : microsoft.aspnet.identity.entityframework.identityuserlogin<tkey> tuserrole : microsoft.aspnet.identity.entityframework.identityuserrole<tkey> tuserclaim : microsoft.aspnet.identity.entityframework.identityuserclaim<tkey> { ... } dbcontext has public property called database. in integration test instantiate appcontext, delete test database, want call context.database.createifnotexists(), database property isn't visible.
dbcontext = new appcontext("testdatabase"); database.delete("testdatabase"); dbcontext.database.createifnotexists(); // error here: appcontext not contain definition 'database'... dbcontext public, database property public, identitydbcontext extends dbcontext, why can't access database property? can't cast appcontext dbcontext, expect able do.
what missing here? it's got simple i'm overlooking.
well turns out overlooking simple: forgot install microsoft.aspnet.identity.entityframework nuget package in integration test project.
Comments
Post a Comment