Replies: 1 comment 2 replies
-
I prefer using separated methods or extension methods instead of inheriting from user manager @mohabbati |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
In TodoTemplate project, there are two methods that send email to the user for an email confirmation and reset password. To avoid repetitive sending emails, we need to add delay for it. I suggest the following implementation:
DateTimeOffset
data type in theUser
class.UserManager<TUser>
class and then add two methods (one for email confirmation and another one for reset password) that return aboolean
value that is it ok to send email?DateTimeOffset.Now
and compare it with the delay value. Finally, it returns abool
result.SendConfirmationEmail
andSendResetPasswordEmail
methods. If the result is true then an email sends to the user otherwise not.Next, in another refactoring we can move the
SendConfirmationEmail
andSendResetPasswordEmail
methods to theUserManagerExtensions
classNote that by using the extension method instead of inheritance we have less refactoring.
What do you think about it?
@ysmoradi @msynk
Beta Was this translation helpful? Give feedback.
All reactions