access_time 5 years ago languageEnglish
more_vert

Migrating from ASP.NET Core 1.x to ASP.NET Core 2.0

visibility 2,781 comment 2
Migrating from ASP.NET Core 1.x to 2.0 is not an easy job especially if you have customized Identity and used customized authentication. This post summarizes the issues and errors I have experienced and their resolutions when upgrading my project. Hopefully it can save you sometime if you are doing ...
info Last modified by Administrator 2 years ago
thumb_up 0

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

comment Comments
5 years ago link more_vert
account_circle Raymond
#179 Re: Migrating from ASP.NET Core 1.x to ASP.NET Core 2.0

@Michael

https://github.com/aspnet/Identity/blob/dev/src/Microsoft.Extensions.Identity.Core/RoleManager.cs

The default query doesn’t include property Users as it is extended by us. Thus, you can write your own Linq query to use entity framework core extension method Include(r=>r.Users) to ensure Users are also loaded.

 In this way, the query generated will be a join SQL.


format_quote

person Michael access_time 5 years ago
Re:Migrating from ASP.NET Core 1.x to ASP.NET Core 2.0

Hello, I've followed your suggestions above but still can't get out how many users that are assigned to a Role. I get: System.Data.SqlClient.SqlException: 'Invalid column name 'ApplicationRoleId'.' when I'm executing following: model = roleManager.Roles.Select(r => new ApplicationRoleListViewModel { Id = r.Id, Name = r.Name, NumberOfUsers = r.Users.Count() }).ToList(); Do you have some ideas on what I have done wrong? Thanks, Michael.
5 years ago link more_vert
account_circle Michael
#89 Re:Migrating from ASP.NET Core 1.x to ASP.NET Core 2.0
Hello, I've followed your suggestions above but still can't get out how many users that are assigned to a Role. I get: System.Data.SqlClient.SqlException: 'Invalid column name 'ApplicationRoleId'.' when I'm executing following: model = roleManager.Roles.Select(r => new ApplicationRoleListViewModel { Id = r.Id, Name = r.Name, NumberOfUsers = r.Users.Count() }).ToList(); Do you have some ideas on what I have done wrong? Thanks, Michael.
timeline Stats
Page index 1.64