You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicsealedclassUserService(IUsersUnitOfWork unitOfWork){privatereadonlyIUsersUnitOfWorkunitOfWork= unitOfWork;publicasyncTask<Result<IUniqueEmailAddress>>EnsureUniqueEmailAddressAsync(EmailAddressemailAddress,UserId?existingUserId=null){varisUnique=awaitthis.unitOfWork.Users.IsUniqueAsync(new UserByEmailAddressSpec(emailAddress),
existingUserId);if(isUnique){returnnew UniqueEmailAddress(emailAddress.Value);}returnnew Error($"A user with the email address '{emailAddress}' already exists.");}publicasyncTask<Result<IUniqueUsername>>EnsureUniqueUsernameAsync(Usernameusername,UserId?existingUserId=null){varisUnique=awaitthis.unitOfWork.Users.IsUniqueAsync(new UserByUsernameSpec(username),
existingUserId);if(isUnique){returnnew UniqueUsername(username.Value);}returnnew Error($"A user with the username '{username}' already exists.");}privatesealedrecordUniqueEmailAddress(stringValue):IUniqueEmailAddress;privatesealedrecordUniqueUsername(stringValue):IUniqueUsername;}
Example
Entity method:
Public interfaces:
Domain service:
Usage in handler:
The text was updated successfully, but these errors were encountered: