Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <param name="sqlServerOptionsAction"></param>
 public static void UseSqlServer(
     [NotNull] this ScorpioDbContextOptions options,
     [CanBeNull] Action <SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)
 {
     options.Configure(context =>
     {
         context.UseSqlServer(sqlServerOptionsAction);
     });
 }
Exemplo n.º 2
0
        public void Configure()
        {
            var context = new ScorpioDbContextOptions();
            var action  = Substitute.For <Action <DbContextConfigurationContext> >();

            context.Configure(action);
            context.DefaultConfigureAction.Invoke(null);
            action.ReceivedWithAnyArgs(1).Invoke(null);
        }
Exemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="TDbContext"></typeparam>
 /// <param name="options"></param>
 /// <param name="sqlServerOptionsAction"></param>
 public static void UseSqlServer <TDbContext>(
     this ScorpioDbContextOptions options,
     Action <SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null)
     where TDbContext : ScorpioDbContext <TDbContext>
 {
     options.Configure <TDbContext>(context =>
     {
         context.UseSqlServer(sqlServerOptionsAction);
     });
 }
Exemplo n.º 4
0
        public void Configure_T()
        {
            var context = new ScorpioDbContextOptions();
            var action  = Substitute.For <Action <DbContextConfigurationContext <TestDbContext> > >();

            context.Configure(action);
            context.ConfigureActions
            .ShouldHaveSingleItem()
            .Action(kv => kv.Key.ShouldBe(typeof(TestDbContext)))
            .Value.ShouldBeOfType <Action <DbContextConfigurationContext <TestDbContext> > >().Invoke(null);
            action.ReceivedWithAnyArgs(1).Invoke(null);
        }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="options"></param>
 /// <param name="sqlServerOptionsAction"></param>
 public static void UseSqlServer(
     this ScorpioDbContextOptions options,
     Action <SqlServerDbContextOptionsBuilder> sqlServerOptionsAction = null) => options.Configure(context => context.UseSqlServer(sqlServerOptionsAction));