You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to cast object of type 'Models.Person' to type 'Models.ApplicationUser'.
I have been trying to work out what the problem is about 2 days now, on and off, but it seems when I use the FinByID, RavenDB, or Identidy.Raven DB for some reason actually matches up with the Person Key in the database. I couldn't understand why I was getting this exception the whole time since I am just calling a method and not trying to cast any thing.
I think I know why its getting the Person entity instead of ApplicationUser.
The entity that was returned useing FindByName, its ID is RavenUsers/[email protected]
I am a newb with RavenDB but I don't understand why the FindByID would get a result from the Persons table and then try and cast it to ApplicationUser?
I have been trying to get a user by their ID, using
UserManager
, which is an email address.For the sake of example [email protected]
I also have a
Model.Person
, which I store in the same database as the RavenUsers, and the Key is also the same email.When I create the user I use this code
var user = new Models.ApplicationUser(userName);
(UserName is the Email)I have now eventually got got this working by using
var user2 = UserManager.FindByName("[email protected]");
The problem is when I use this
var user3 = UserManager.FindById("[email protected]");
I get an exception
Unable to cast object of type 'Models.Person' to type 'Models.ApplicationUser'.
I have been trying to work out what the problem is about 2 days now, on and off, but it seems when I use the
FinByID
, RavenDB, or Identidy.Raven DB for some reason actually matches up with the Person Key in the database. I couldn't understand why I was getting this exception the whole time since I am just calling a method and not trying to cast any thing.When I use
var user3 = UserManager.FindByEmail("[email protected]");
It reutrns NULL, even though in the database under ApplciationUsers, the Email is the same as UserName and the same as the Key.
Is this a Identity.RavenDB problem?
The text was updated successfully, but these errors were encountered: