I have added an external Id to users: SomId. Now i want to add a GetUserBySomId(int somId)
What is the best Zero way to do that?
Thanks in advance, Rene van Woezik
5 Answer(s)
-
0
src\MyCompanyName.AbpZeroTemplate.Core\Authorization\Users\UserManager.csYou can define the method directly in the
UserManager.Then inject the
UserManagerelsewhere and call the relevant methods.Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @maliming, thanks for your quick reply. Shoud i use the IRepository<User, long> in my method to find the user??
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
The UserManager constructor injects some services, such as UserStore. You can use them directly, There are also many methods in the base class that you can use.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thnx! This is wat i have done in UserManager.cs:
public User GetUserBySomId(int somId) { return Users.FirstOrDefault(u => u.SpotOnMedicsId == somId); }And it worksMarkdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
I suggest you use [UnitOfWork] for your method.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)