public void InitDatabaseForIdGenerator() { var kormBuilder = new KormBuilder(new ServiceCollection(), ServerHelper.Connection.ConnectionString); kormBuilder.InitDatabaseForIdGenerator(); CheckTableAndProcedure(); }
public void InitDatabaseForIdGenerator() { KormBuilder kormBuilder = CreateKormBuilder(); kormBuilder.InitDatabaseForIdGenerator(); CheckTableAndProcedure(); }
public void UseDefaultConnectionStringIfConfigurationIsProvided() { IConfigurationRoot configuration = ConfigurationHelper.GetConfiguration(); var services = new ServiceCollection(); KormBuilder builder = services.AddKorm(configuration); builder.ConnectionSettings.ConnectionString.Should().Be(configuration.GetConnectionString("DefaultConnection")); }
public void UseDatabaseConfiguration() { KormBuilder kormBuilder = CreateKormBuilder(false); DatabaseConfigurationBase configuration = Substitute.For <DatabaseConfigurationBase>(); kormBuilder.UseDatabaseConfiguration(configuration); IDatabase database = kormBuilder.Build(); database.Should().NotBeNull(); configuration.Received().OnModelCreating(Arg.Any <ModelConfigurationBuilder>()); }
private KormBuilder CreateKormBuilder() { var connectionSettings = new ConnectionStringSettings( "Default", ServerHelper.Connection.ConnectionString, "System.Data.SqlClient"); var kormBuilder = new KormBuilder(new ServiceCollection(), connectionSettings); return(kormBuilder); }
public void InitDatabaseForIdGenerator() { var connectionSettings = new ConnectionStringSettings( "Default", ServerHelper.Connection.ConnectionString, "System.Data.SqlClient"); var kormBuilder = new KormBuilder(new ServiceCollection(), connectionSettings); kormBuilder.InitDatabaseForIdGenerator(); CheckTableAndProcedure(); }
private static void Migrate(KormBuilder kormBuilder) { var policy = Policy .Handle <SqlException>() .OrInner <SocketException>() .OrInner <SqlException>() .WaitAndRetry(10, retryAttempt => { Console.WriteLine($"=== Migrate retry attempt: {retryAttempt}"); return(TimeSpan.FromSeconds(2)); }); policy.Execute(kormBuilder.Migrate); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSwaggerDocumentation(Configuration); services.AddTransient <IOrderRepository, OrderRepository>(); services.AddTransient <DummyDataInitializer>(); services.AddControllers(); KormBuilder kormBuilder = services.AddKorm(Configuration) .UseDatabaseConfiguration <DatabaseConfiguration>() .AddKormMigrations(); Migrate(kormBuilder); }