ASP.NET MVC 5 Identity userManager.IsInRole

后端 未结 1 1910
温柔的废话
温柔的废话 2021-01-14 07:29

The following code does not work, and I can\'t explain why... My user manager is causing significant distress in that it creates users and roles just fine but when I run thi

1条回答
  •  渐次进展
    2021-01-14 08:32

    So I will answer this myself to save anyone the hours of pain I suffered because of this.

    The reason for this occurring was that I had lazy loading disabled, I have enabled this to be on in my Migrations project like so.

    protected override void Seed(BlogContext blogContext)
        {
            AutomaticMigrationsEnabled = true;
            blogContext.Configuration.LazyLoadingEnabled = true;
            //Add seed classes here!    
        }
    

    0 讨论(0)
提交回复
热议问题