Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example for SO 33845962
namespace Simple.Models
{
public class Entry
{
public int EntryID { get; set; }
public string SomeString { get; set; }
}
}
namespace Simple.Models
{
public class Entry
{
public int EntryID { get; set; }
public string SomeString { get; set; }
}
}
{
"version": "1.0.0-*",
"tooling": {
"defaultNamespace": "Simple"
},
"dependencies": {
"EntityFramework.Commands": "7.0.0-rc1-final",
"EntityFramework.Sqlite": "7.0.0-rc1-final"
},
"commands": {
"ef": "EntityFramework.Commands"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.Data.Entity;
namespace Simple
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddEntityFramework()
.AddSqlite()
.AddDbContext<Models.SimpleContext>(options =>
{
var appEnv = CallContextServiceLocator.Locator.ServiceProvider
.GetRequiredService<IApplicationEnvironment>();
options.UseSqlite($"Data Source={ appEnv.ApplicationBasePath }/sample.sqlite");
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment