1

這有沒有問題:爲什麼UserStore和RoleStore之間存在實現差異?

public class ApplicationUserStore : UserStore<ApplicationUser, ApplicationRole, string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim> 
{ 
    public ApplicationUserStore(MyAppDb context) 
     : base(context) 
    { 
    } 
} 

這枚:

public class ApplicationRoleStore : RoleStore<ApplicationRole, string, ApplicationUserRole> 
{ 
    public ApplicationRoleStore(MyAppDb context) 
     : base(context) 
    { 
    } 
} 

...產生以下編譯時錯誤:

The type 'MyApp.Models.ApplicationRole' cannot be used as a type parameter 'TRole' in the generic type or method 'Microsoft.AspNet.Identity.EntityFramework.RoleStore'. There is no implicit reference conversion from 'MyApp.Models.ApplicationRole' to 'Microsoft.AspNet.Identity.EntityFramework.IdentityRole'.

此問題試圖解決這個問題來了這裏: Why is UserManager.CreateIdentityAsync() looking for IdentityRole and how to fix?

只要我解決這個問題,我並不在乎我解決這個問題。謝謝。

回答

1

這裏沒有問題,沒有實現差異。它一定是一個呃逆。重新啓動Visual Studio 2013不能解決編譯時錯誤。但是,電腦重啓了。 這裏沒有問題 - 移動。

相關問題