Skip to content

Creating the Repository

Patrick edited this page Nov 2, 2016 · 4 revisions

The Configuration.EntityFramework provider requires a Repository compatible with EntityFrameworkCore and the ConfigurationContext.

The Database Schema can be used to create the database. Alternatively, the ConfigurationContext can be used to programmatically create the database. If using ConfigurationContext Database EnsureCreated() then please refer to Known Issues before starting.

Sample Code

var options = new DbContextOptionsBuilder<ConfigurationContext>().UseSqlServer(
      @"Data Source=.;Initial Catalog=Configuration;Integrated Security=True").Options;

using (var context = new ConfigurationContext(options))
{
  context.Database.EnsureCreated();
}
Clone this wiki locally