/// <summary> /// Create /// </summary> /// <param name="databaseConnectionInfo"></param> /// <returns></returns> public virtual async Task CreateAsync(DatabaseConnectionInfo databaseConnectionInfo) { var queryDatabaseConnectionInfo = await DatabaseConnectionInfoRepository.FindExpectedByNameAsync(databaseConnectionInfo.Name); if (queryDatabaseConnectionInfo != null) { throw new AbpException($"Duplicate dbConnection name '{databaseConnectionInfo.Name}'."); } await DatabaseConnectionInfoRepository.InsertAsync(databaseConnectionInfo); }
public virtual async Task <Guid> CreateAsync(CreateDatabaseConnectionInfoDto input) { var databaseConnectionInfo = new DatabaseConnectionInfo( GuidGenerator.Create(), input.Name, input.DatabaseProvider, input.ConnectionString); await DatabaseConnectionInfoManager.CreateAsync(databaseConnectionInfo); return(databaseConnectionInfo.Id); }
public static DatabaseConnectionInfoCacheItem AsCacheItem([NotNull] this DatabaseConnectionInfo databaseConnectionInfo) { Check.NotNull(databaseConnectionInfo, nameof(databaseConnectionInfo)); if (databaseConnectionInfo == null || databaseConnectionInfo == default) { return(null); } var cacheItem = new DatabaseConnectionInfoCacheItem() { Name = databaseConnectionInfo.Name, DatabaseProvider = databaseConnectionInfo.DatabaseProvider, ConnectionString = databaseConnectionInfo.ConnectionString }; return(cacheItem); }