Esempio n. 1
0
        public async Task <int> AddAsync(string accountId, string name, string code, ProviderType provider, string connectionString)
        {
            if (await _repository.ExistsCodeAsync(code))
            {
                throw new BusiException("编码已存在");
            }
            var model = new TDatabase
            {
                Id               = IdentityHelper.Guid32,
                AccountId        = accountId,
                Name             = name,
                Code             = code,
                Provider         = (byte)provider,
                ConnectionString = connectionString,
                CreateTime       = Clock.Now,
                Status           = (byte)CommonStatus.Normal
            };

            return(await _repository.InsertAsync(model));
        }