Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="redisManager"></param>
 /// <param name="dataBaseOptionService"></param>
 public RedisOptionService(
     IRedisManager redisManager
     , IDataBaseOptionService dataBaseOptionService)
 {
     _redisManager          = redisManager;
     _dataBaseOptionService = dataBaseOptionService;
 }
Exemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="dataBaseOptionService"></param>
 /// <param name="mapper"></param>
 public DatabaseCurdController(
     ILogger <DatabaseCurdController> logger
     , IDataBaseOptionService dataBaseOptionService
     , IMapper mapper)
 {
     _logger = logger;
     _dataBaseOptionService = dataBaseOptionService;
     _mapper = mapper;
 }
Exemplo n.º 3
0
            /// <summary>
            /// 模型验证
            /// </summary>
            public XXXAoValidator(IDataBaseOptionService dataBaseOptionService)
            {
                //Id必须
                RuleFor(x => x.Id).GreaterThan((uint)1).WithMessage("Id不能小于1")
                .MustAsync(async(s, a, x) =>
                {
                    bool IssuerValidate = false;
                    if ((await dataBaseOptionService.FindAsync(s.Id)).Result != null)
                    {
                        IssuerValidate = true;
                    }
                    return(IssuerValidate);
                }).WithMessage("数据库未找到对应数据数据不存在");

                RuleFor(t => t.UserName).NotEmpty().WithMessage("名称不能为空")
                .Length(1, 20).WithMessage("名称长度在1-20个字符之间");
            }
Exemplo n.º 4
0
 /// <summary>
 /// 验证
 /// </summary>
 public XXXValidator(IDataBaseOptionService xXXService)
 {
     RuleFor(t => t.Name).NotEmpty().WithMessage("名称不能为空")
     .Length(1, 20).WithMessage("名称长度在1-20个字符之间");
 }