예제 #1
0
 public UsersController(ApplicationDbContext context, ILogger <UsersController> logger, PasswordHashSettings passwordHashSettings, MailSettings mailSettings)
 {
     _context = context;
     _logger  = logger;
     _passwordHashSettings = passwordHashSettings;
     _mailSettings         = mailSettings;
 }
예제 #2
0
        private static void ValidateAppSettings(FilePathSettings filePathSettings, PasswordHashSettings passwordHashSettings, MailSettings mailSettings)
        {
            var resultsValidation = new List <ValidationResult>();

            Validator.TryValidateObject(filePathSettings, new ValidationContext(filePathSettings), resultsValidation, true);
            Validator.TryValidateObject(passwordHashSettings, new ValidationContext(passwordHashSettings), resultsValidation, true);
            Validator.TryValidateObject(mailSettings, new ValidationContext(mailSettings), resultsValidation, true);

            resultsValidation.ForEach(error => Console.WriteLine(error.ErrorMessage));
        }