private static string CreateConnectionString(string name)
        {
            var connStrBuilder = new SqlConnectionStringBuilder
            {
                MultipleActiveResultSets = true,
                InitialCatalog           = name
            };

            return(connStrBuilder.ApplyConfiguration().ConnectionString);
        }
Exemple #2
0
        public static string CreateConnectionString(string name)
        {
            var connStrBuilder = new SqlConnectionStringBuilder
            {
                //MultipleActiveResultSets = false,
                MultipleActiveResultSets = new Random().Next(0, 2) == 1,
                InitialCatalog           = name
            };

            return(connStrBuilder.ApplyConfiguration().ConnectionString);
        }
        public MigrationsSqlServerFixture()
        {
            _serviceProvider = new ServiceCollection()
                               .AddEntityFramework()
                               .AddSqlServer()
                               .ServiceCollection()
                               .BuildServiceProvider();

            var connectionStringBuilder = new SqlConnectionStringBuilder
            {
                InitialCatalog = nameof(MigrationsSqlServerTest)
            };

            connectionStringBuilder.ApplyConfiguration();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseSqlServer(connectionStringBuilder.ConnectionString);
            _options = optionsBuilder.Options;
        }
Exemple #4
0
        public NavigationTestFixture()
        {
            _serviceProvider = new ServiceCollection()
                               .AddEntityFramework()
                               .AddSqlServer()
                               .ServiceCollection()
                               .BuildServiceProvider();

            var connStrBuilder = new SqlConnectionStringBuilder
            {
                InitialCatalog           = "StateManagerBug",
                MultipleActiveResultSets = true,
                ["Trusted_Connection"]   = true
            };

            connStrBuilder.ApplyConfiguration();

            var optionsBuilder = new DbContextOptionsBuilder();

            optionsBuilder.UseSqlServer(connStrBuilder.ConnectionString);
            _options = optionsBuilder.Options;
        }