public virtual SqlServerDbContextOptionsBuilder SuppressAmbientTransactionWarning() { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { ThrowOnAmbientTransaction = false }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { SqlServerOptionsExtension extension = options.FindExtension<SqlServerOptionsExtension>(); if (extension != null) this.ConnectionString = extension.ConnectionString; else this.ConnectionString = this.Database.GetDbConnection().ConnectionString; }
public virtual SqlServerDbContextOptionsBuilder SuppressAmbientTransactionWarning() { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { ThrowOnAmbientTransaction = false }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerDbContextOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { MigrationsAssembly = assemblyName }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerDbContextOptionsBuilder CommandTimeout(int?commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { CommandTimeout = commandTimeout }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerDbContextOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { MaxBatchSize = maxBatchSize }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerEntityOptionsBuilder SuppressAmbientTransactionWarning() { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { ThrowOnAmbientTransaction = false }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerEntityOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { MigrationsAssembly = assemblyName }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerEntityOptionsBuilder CommandTimeout(int?commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { CommandTimeout = commandTimeout }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerEntityOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension <SqlServerOptionsExtension>()) { MaxBatchSize = maxBatchSize }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerEntityOptionsBuilder SuppressAmbientTransactionWarning() { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { ThrowOnAmbientTransaction = false }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerEntityOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { MigrationsAssembly = assemblyName }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerEntityOptionsBuilder CommandTimeout(int? commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { CommandTimeout = commandTimeout }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerEntityOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { MaxBatchSize = maxBatchSize }; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension<SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.MigrationsAssembly = assemblyName; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension<SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.MaxBatchSize = maxBatchSize; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder CommandTimeout(int? commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension<SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.CommandTimeout = commandTimeout; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { MigrationsAssembly = assemblyName }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder CommandTimeout(int? commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { CommandTimeout = commandTimeout }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.GetExtension<SqlServerOptionsExtension>()) { MaxBatchSize = maxBatchSize }; ((IDbContextOptionsBuilderInfrastructure)OptionsBuilder).AddOrUpdateExtension(extension); return this; }
public virtual SqlServerDbContextOptionsBuilder CommandTimeout(int?commandTimeout) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension <SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.CommandTimeout = commandTimeout; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerDbContextOptionsBuilder MaxBatchSize(int maxBatchSize) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension <SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.MaxBatchSize = maxBatchSize; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public virtual SqlServerDbContextOptionsBuilder MigrationsAssembly([NotNull] string assemblyName) { var extension = new SqlServerOptionsExtension(OptionsBuilder.Options.FindExtension <SqlServerOptionsExtension>()); Debug.Assert(extension != null); extension.MigrationsAssembly = assemblyName; ((IOptionsBuilderExtender)OptionsBuilder).AddOrUpdateExtension(extension); return(this); }
public void Can_access_properties() { var configuration = new SqlServerOptionsExtension(); Assert.Null(configuration.Connection); Assert.Null(configuration.ConnectionString); var connection = Mock.Of<DbConnection>(); configuration.Connection = connection; configuration.ConnectionString = "Fraggle=Rock"; Assert.Same(connection, configuration.Connection); Assert.Equal("Fraggle=Rock", configuration.ConnectionString); }
public void Can_access_properties() { var configuration = new SqlServerOptionsExtension(); Assert.Null(configuration.Connection); Assert.Null(configuration.ConnectionString); var connection = Mock.Of <DbConnection>(); configuration.Connection = connection; configuration.ConnectionString = "Fraggle=Rock"; Assert.Same(connection, configuration.Connection); Assert.Equal("Fraggle=Rock", configuration.ConnectionString); }
// NB: When adding new options, make sure to update the copy ctor below. /// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> protected SqlServerOptionsExtension(SqlServerOptionsExtension copyFrom) : base(copyFrom) { }