Last active
November 24, 2015 22:12
-
-
Save ChristopherHackett/dd414fa5acf24d9b9255 to your computer and use it in GitHub Desktop.
Example for SO 33845962
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Simple.Models | |
{ | |
public class Entry | |
{ | |
public int EntryID { get; set; } | |
public string SomeString { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Simple.Models | |
{ | |
public class Entry | |
{ | |
public int EntryID { get; set; } | |
public string SomeString { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": { } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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