I am trying to implement authentication with .Net core 2.0 angular template (in visual studio 2017). I have attempted with asp.net Identity trying to follow this tutorial
I am getting stuck right away with adding the dbContext to startUp.cs.
StartUp.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDbContext<EduSmartContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddMvc();
}
I get this error In startup.cs when adding applicationDbContext:
the type 'EduSmart.Data.ApplicationDbContext' cannot be used as type parameter 'TContext' in the generic type or method 'EntityFrameworkServiceCollectionExtensions.AddDbContext(IServiceCollection, Action, ServiceLifetime, ServiceLifetime)'. There is no implicit reference conversion from 'EduSmart.Data.ApplicationDbContext' to 'Microsoft.EntityFrameworkCore.DbContext'. EduSmart C:\src\EduSmart\Startup.cs 30 Active
I am looking for one of these three options:
- Resolve the error above.
- A link to a more clear step by step tutorial to implement authentication with asp.net Identity
- Suggest a better way to authenticate Angular Asp.Net core app with a linked resource
DbContext
s ? - KavehG