コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }