There is signature of UserManager
method (ASP .NET Identity Core default implementation):
public Task<IList<string>> GetRolesAsync(User user) {
const string query = @"
select r.[Name]
from [UserRoles] ur
left join [Roles] r on r.RoleId = ur.RoleId
where ur.UserId = @userId;
";
return Task.Factory.StartNew(() => {
using (SqlConnection connection = new SqlConnection(_connectionString))
return connection.Query<string>(query, new { userId = user.UserId });
});
}
But unfortunately Dapper.Query<T>
returns IEnumerable<T>
.
Is it possible to return IList<T>
or i have to make conversion myself?