0

我正在使用带有重命名表名的 UserManager 功能(通过数据库上下文配置):

        modelBuilder.Entity<User>().ToTable("Users");            
        modelBuilder.Entity<IntUserRole>().ToTable("UserRoles");
        modelBuilder.Entity<IntUserLogin>().ToTable("UserLogins");
        modelBuilder.Entity<IntUserClaim>().ToTable("UserClaims");
        modelBuilder.Entity<IntRole>().ToTable("Roles");

现在,一旦 id 喜欢使用带有 Roles 选项的 [Authorize] 属性,id 需要再次启动我的数据库的 aspnet_regsql.exe 以创建所有必需的存储过程。

不幸的是,它创建了一组新的默认命名表(aspne_Roles ...)。

有没有办法让它重用我的桌子?

4

1 回答 1

0

Solved this. Issue was related to wrong configuration. Basically i didnt need any special role management feature, but simply check if user assigned to not to the role.

To resolve, i changed my configuration to use a simple as possible one:

<roleManager enabled="true">

Now, my renamed tables used for role management along with my UserManager initialized for my default site context.

于 2014-04-22T15:23:42.413 回答