示例#1
0
        public string Resolve([NotNull] string name)
        {
            Check.NotNullOrWhiteSpace(name, nameof(name));

            var connectionStringProvider = _connectionStringStore.Get(name);

            if (connectionStringProvider != null)
            {
                return(connectionStringProvider.ConnectionString);
            }

            if (this._connectionStringProviderDict.TryGetValue(name, out connectionStringProvider))
            {
                return(connectionStringProvider.ConnectionString);
            }

            name = RivenUnitOfWorkConsts.DefaultConnectionStringName;

            connectionStringProvider = _connectionStringStore.Get(name);
            if (connectionStringProvider != null)
            {
                return(connectionStringProvider.ConnectionString);
            }

            if (this._connectionStringProviderDict.TryGetValue(name, out connectionStringProvider))
            {
                return(connectionStringProvider.ConnectionString);
            }


            throw new ArgumentException($"具有默认名称的连接字符串不存在");
        }
示例#2
0
        public string Resolve(string name)
        {
            var connectionStringProvider = _connectionStringStore.Get(name);

            if (connectionStringProvider != null)
            {
                return(connectionStringProvider.ConnectionString);
            }

            if (this._connectionStringProviderDict.TryGetValue(name, out connectionStringProvider))
            {
                return(connectionStringProvider.ConnectionString);
            }


            throw new ArgumentException($"The connection string with the name {name} does not exist");
        }