Skip to content

Instantly share code, notes, and snippets.

@johanclasson
Last active March 24, 2016 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johanclasson/51cf3fb527af8798c9f2 to your computer and use it in GitHub Desktop.
Save johanclasson/51cf3fb527af8798c9f2 to your computer and use it in GitHub Desktop.
internal class MyContext : DbContext
{
// ...
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured) // This prevents multiple configurations
{
optionsBuilder.UseSqlite(@"Data Source=c:\temp\mydatabase.sqlite;");
}
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment