public LabController(
     ILogger <LabController> logger,
     ICrudRepositoryFactory crudRepository
     )
 {
     _logger         = logger;
     _crudRepository = crudRepository;
 }
        public AuthenticationLoader(
            ICrudRepositoryFactory crudRepositoryFactory,
            IConfiguration configuration
            ) : this(crudRepositoryFactory)
        {
            var iterationsSettings = configuration.GetValue <int>("AppSettings:Authorization:Iterations");
            var saltLengthSettings = configuration.GetValue <int>("AppSettings:Authorization:SaltLength");
            var hashLengthSettings = configuration.GetValue <int>("AppSettings:Authorization:HashLength");

            if (iterationsSettings > 0)
            {
                Iterations = iterationsSettings;
            }
            if (saltLengthSettings > 0)
            {
                SaltLength = saltLengthSettings;
            }
            if (hashLengthSettings > 0)
            {
                HashLength = hashLengthSettings;
            }
        }
Exemple #3
0
        public AddUserValidator(
            ICrudRepositoryFactory crudRepositoryFactory
            )
        {
            _repository = crudRepositoryFactory.Get <User>();

            RuleFor(x => x.Birthday)
            .NotNull()
            .NotEmpty()
            .WithMessage(Errors.Messages.NoBirthday)
            .WithErrorCode(Errors.Codes.NoBirthday);

            RuleFor(x => x.UserName)
            .NotNull()
            .NotEmpty()
            .WithMessage(Errors.Messages.NoUsername)
            .WithErrorCode(Errors.Codes.NoUsername);

            RuleFor(x => x)
            .Must(y =>
            {
                if (y.IdType != Entities.Enum.IDTypeEnum.Internal)
                {
                    return(!string.IsNullOrWhiteSpace(y.ExternalID));
                }
                else
                {
                    return(true);
                }
            });

            RuleFor(x => x)
            .MustAsync((x, c) => UserNotYetExist(x))
            .WithMessage(Errors.Messages.UserExists)
            .WithErrorCode(Errors.Codes.UserExists);
        }
 public static object Create([NotNull] this ICrudRepositoryFactory repositoryFactory, [NotNull] Type entityType) =>
 CreateCrudMethod.MakeGenericMethod(entityType).Invoke(repositoryFactory, null);
 /// <summary>
 /// Creates a new reference-dehydrating decorator.
 /// </summary>
 /// <param name="inner">The inner factory to use for the actual storage.</param>
 public DehydratingCrudRepositoryFactory([NotNull] ICrudRepositoryFactory inner)
     : base(inner)
 {
     _inner = inner;
 }
 public AuthenticationLoader(
     ICrudRepositoryFactory crudRepositoryFactory
     )
 {
     _passwordsRepository = crudRepositoryFactory.Get <PasswordRecord>();
 }