bil*_*por 0 c# asp.net-mvc asp.net-identity
一切正常,直到我介绍身份.
我将上下文类更改为:
public partial class VisualJobsDbContext : IdentityDbContext<ApplicationUser>
{
private IConfigurationRoot _config;
public VisualJobsDbContext() { }
public VisualJobsDbContext(IConfigurationRoot config, DbContextOptions options) : base(options)
{
_config = config;
}...
Run Code Online (Sandbox Code Playgroud)
我有一个在表单中声明的通用存储库:
public abstract class GenericRepository<C,T> : IGenericRepository<T> where T : class where C : IdentityDbContext<ApplicationUser>, new()
{
private C _entities = new C();
private VisualJobsDbContext context;
private DbSet<T> dbSet;
public GenericRepository(VisualJobsDbContext context)
{
this.context = context;
this.dbSet = context.Set<T>();
}....
Run Code Online (Sandbox Code Playgroud)
错误发生在
this.dbSet = context.Set <>();
它第一次被击中.我的OnModelCreating方法确实被调用了.我试图从我的MVC应用程序访问的页面不需要登录,因为它是一般页面,但是会有需要登录的区域.但是,在错误之前,我没有得到我的控制器Constructor方法.注册我的服务:
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<VisualJobsDbContext>()
.AddDefaultTokenProviders();
Run Code Online (Sandbox Code Playgroud)
我可以踩到这个.
我缺少什么想法?我看过这个stackoverflow的答案和其他人,但它并没有真正帮助
| 归档时间: |
|
| 查看次数: |
1521 次 |
| 最近记录: |