grandchamp / Identity.Dapper

Identity package that uses Dapper instead EntityFramework for use with .NET Core
MIT License
268 stars 62 forks source link

Roles Empty #57

Closed terzano closed 6 years ago

terzano commented 6 years ago

I am having an issue with roles. When I retrieve a user that has roles assigned by doing:

var user = await _userManager.FindByEmailAsync(model.Email);

The roles collection is returned empty. The same occur w/ FindByIdAsync & FindByNameAsync Thanks for your work on this library.

grandchamp commented 6 years ago

Well, what is the behavior of MS Identity? It's lazy loaded or it brings when you use Find methods? To fix this i'll have to make joins on tables and have a hard mapping, maybe it's easier to use GetRolesAsync.

grandchamp commented 6 years ago

Fixed in https://github.com/grandchamp/Identity.Dapper/commit/a6dceec67d5516fe14a0feb1c72913be91d322aa

I have to work on FindByLogin.

grandchamp commented 6 years ago

FindByLogin fixed in https://github.com/grandchamp/Identity.Dapper/commit/ca4e39de2e638838fa9ab4cb4fc6a2578398905d

Check NuGet for the 0.6.3 version.

terzano commented 6 years ago

Thank you very much for your quick response and fix. I was about to send a PR. I was taking a similar approach with the LEFT JOINS. Again, great work on this lib. Filled a much needed gap. I am not a fan of EF and tend to use Dapper and other micro ORM's on all my projects.

grandchamp commented 6 years ago

Oh, If you told me that you were preparing a PR i wouldnt have done. 😁 Thanks for the words! Glad you liked It.