Esempio n. 1
0
        public async Task AddNamespaceAsync(AddNamespaceModel model)
        {
            if (await _namespaceRepository.ExistedAsync(m => m.Name.Equals(model.Name) && m.ProjectID.Equals(model.ProjectID)))
            {
                throw new ConfigCenterException("名称已存在");
            }
            var @namespace = model.CopyProperties <Namespace>();

            _configCenterSqliteEFUnitOfWork.RegisterAdd(@namespace);
            await _configCenterSqliteEFUnitOfWork.CommitAsync();
        }
Esempio n. 2
0
        public async Task AddProjectAsync(AddProjectModel model)
        {
            if (await _projectRepository.ExistedAsync(m => m.Name.Equals(model.Name)))
            {
                throw new ConfigCenterException("名称已存在");
            }
            var project = model.CopyProperties <Project>();

            _configCenterSqliteEFUnitOfWork.RegisterAdd(project);
            _configCenterSqliteEFUnitOfWork.RegisterAdd(new Namespace
            {
                Name        = "Application",
                Description = "默认命名空间",
                ProjectID   = project.ID
            });
            await _configCenterSqliteEFUnitOfWork.CommitAsync();
        }