コード例 #1
0
        protected virtual SqlConnectionStringBuilder BuildConnectionString(IClousotCacheOptions options)
        {
            Contract.Requires(options != null);
            Contract.Ensures(Contract.Result <SqlConnectionStringBuilder>() != null);

            return(new SqlConnectionStringBuilder
            {
                IntegratedSecurity = true,
                InitialCatalog = options.GetCacheDBName(),
                DataSource = this.DbName,
                UserInstance = false,
                MultipleActiveResultSets = true,
                ConnectTimeout = options.CacheServerTimeout,
            });
        }
コード例 #2
0
        protected override SqlConnectionStringBuilder BuildConnectionString(IClousotCacheOptions options)
        {
            if (!string.IsNullOrWhiteSpace(options.CacheDirectory))
            {
                var name = options.GetCacheDBName();
                return(new SqlConnectionStringBuilder
                {
                    IntegratedSecurity = true,
                    InitialCatalog = name,
                    DataSource = this.DbName,
                    UserInstance = false,
                    MultipleActiveResultSets = true,
                    ConnectTimeout = options.CacheServerTimeout,
                    AttachDBFilename = Path.Combine(options.CacheDirectory.AssumeNotNull(), name + ".mdf")
                });
            }

            return(base.BuildConnectionString(options));
        }