The argument type is not assigned to the parameter type although it inherits
I tried to write an ASP.net id MVC application from scratch. For this I followed two tutorials from Ben Foster ( Tutorial Part1 and Tutorial Part2 )
But I am stuck with the second tutorial - Configuring UserManager. The following line doesn't work for me:
// configure the user manager
UserManagerFactory = () =>
{
var usermanager = new UserManager<AppUser>(
new UserStore<AppUser>(new AppDbContext()));
...
}
Visual Studio highlights
new AppDbContext()
and will show me the following message:
The argument type "MyProject.DbContext.AppDbContext" is not assigned to the parameter type "System.Data.Entity.DbContext"
I don't understand why this doesn't work in my solution because I followed the tutorial completely. My AppDbContext looks like this:
namespace MyProject.DbContext
{
using MyProject.Models;
using Microsoft.AspNet.Identity.EntityFramework;
public class AppDbContext : IdentityDbContext<User>
{
public AppDbContext()
: base("DefaultConnection")
{
}
}
}
My user class:
namespace MyProject.Models
{
using Microsoft.AspNet.Identity.EntityFramework;
public class User : IdentityUser
{
public string Name{ get; set; }
}
}
I also downloaded the source code from Ben and tried to run it and it works without issue. I guess it doesn't matter that all my files are not in the same folder ?!
Hope you can help me. It's really frustrating if a simple tutorial doesn't work as it should ...
Regards, winklerrr
source to share