Skip to content

Instantly share code, notes, and snippets.

@ChristopherHackett
Last active November 24, 2015 22:12
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 ChristopherHackett/dd414fa5acf24d9b9255 to your computer and use it in GitHub Desktop.
Save ChristopherHackett/dd414fa5acf24d9b9255 to your computer and use it in GitHub Desktop.
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