Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example of how to add EF 7 for SQLite to ASP.Net Core startup class
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration);
services.AddMvc();
// Add SQLite DB using EF Core
var path = PlatformServices.Default.Application.ApplicationBasePath;
var connection = $"Filename={Path.Combine(path, "mydb.db")}";
services.AddEntityFramework()
.AddSqlite()
.AddDbContext<MyDBContext>(
options =>
{ options.UseSqlite(connection); });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment