public void Can_depend_on_DbContextOptions_with_default_service_provider()
 {
     using (SqlServerTestStore.GetNorthwindStore())
     {
         using var context = new OptionsContext(
                   new DbContextOptions <OptionsContext>(),
                   new SqlConnection(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString));
         Assert.True(context.Customers.Any());
     }
 }
示例#2
0
 public void CanUseOptionsInDbContextCtor()
 {
     using (var context = new OptionsContext(new DbContextOptions <OptionsContext>(),
                                             new MySqlConnection(MySQLTestStore.CreateConnectionString("db-optionsindbcontext"))))
     {
         context.Database.EnsureCreated();
         Assert.True(context.Blogs.Count() == 0);
         context.Database.EnsureDeleted();
     }
 }
示例#3
0
 public async void Can_depend_on_DbContextOptions_with_default_service_provider()
 {
     using (await SqlServerNorthwindContext.GetSharedStoreAsync())
     {
         using (var context = new OptionsContext(
                    new DbContextOptions <OptionsContext>(),
                    new SqlConnection(SqlServerNorthwindContext.ConnectionString)))
         {
             Assert.True(context.Customers.Any());
         }
     }
 }
 public void Can_depend_on_DbContextOptions_with_default_service_provider()
 {
     using (NpgsqlTestStore.GetNorthwindStore())
     {
         using (var context = new OptionsContext(
                    new DbContextOptions <OptionsContext>(),
                    new NpgsqlConnection(NpgsqlTestStore.NorthwindConnectionString)))
         {
             Assert.True(context.Customers.Any());
         }
     }
 }
示例#5
0
 protected override void OnChange()
 {
     OptionsContext.Show(Cursor.Position.X, Cursor.Position.Y);
 }
 public AsyncRefreshConfigurationSource(Func <OptionsContext, Task> updateProcess)
 {
     OptionsContext          = new OptionsContext();
     _optionsUpdatingProcess = Task.Run(async() => await updateProcess.Invoke(OptionsContext));
 }
 public void Can_depend_on_DbContextOptions_with_default_service_provider()
 {
     using (SqlServerNorthwindContext.GetSharedStore())
     {
         using (var context = new OptionsContext(
             new DbContextOptions<OptionsContext>(),
             new SqlConnection(SqlServerNorthwindContext.ConnectionString)))
         {
             Assert.True(context.Customers.Any());
         }
     }
 }
示例#8
0
 public YearTermsController(OptionsContext context)
 {
     _context = context;
 }
 public OptionsWithSecondLevel(OptionsContext context, string[] args = null)
     : base(context)
 {
 }
示例#10
0
 public ChoicesController(OptionsContext context)
 {
     _context = context;
 }
 public OptionsController(OptionsContext context)
 {
     _context = context;
 }