MR.AspNet.Identity.EntityFramework6 icon indicating copy to clipboard operation
MR.AspNet.Identity.EntityFramework6 copied to clipboard

FindByIdAsync in UserStore takes 'string' Ids by default (even when inherited from UserStoreInt)

Open karandesai28 opened this issue 8 years ago • 2 comments

Here is my UserStoreInt implementation,

public class UserStore : UserStoreInt<DbContext>
    {       
        public UserStore(DbContext context)
            : base(context)
        {
        }
    }

And I am accessing FindByIdAsync method in some repository as:

await _userStore.FindByIdAsync(userId) //datatype of userId is int

On checking the definition of FindByIdAsync here, I found that the parameter of the function has 'string' hardcoded.

I think it should have TKey instead of string because, UserStoreInt also implements this method. I realized that you have called "ConvertIdFromString" inside that method, but that rarely would work in real scenarios because the one using int as type will have to explicitly convert Ids to string and then in your method, it will reconvert to int.

I can make that small change and send a PR. Need your confirmation.

karandesai28 avatar Oct 25 '17 08:10 karandesai28

Yes, that seems to be the case. A PR would be appreciated.

mrahhal avatar Oct 25 '17 08:10 mrahhal

It also seems that other methods like GetUserIdAsync return a string. That might also be a mistake.

mrahhal avatar Oct 25 '17 08:10 mrahhal