-
-
Save natemcmaster/90e2388c0ee1d29f440a to your computer and use it in GitHub Desktop.
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
dnx . ef migration add Initial | |
Using context 'MyContext'. | |
System.InvalidOperationException: A type named 'StartupProduction' or 'Startup' could not be found in assembly 'ef-xplat'. | |
at Microsoft.AspNet.Hosting.Startup.StartupLoader.FindStartupType (System.String startupAssemblyName, IList`1 diagnosticMessages) [0x00000] in <filename unknown>:0 | |
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureStartup () [0x00000] in <filename unknown>:0 | |
at Microsoft.AspNet.Hosting.Internal.HostingEngine.EnsureApplicationServices () [0x00000] in <filename unknown>:0 | |
at Microsoft.AspNet.Hosting.Internal.HostingEngine.get_ApplicationServices () [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.ContextTool.TryCreateContextFromStartup (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.ContextTool.CreateContext (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.MigrationTool.CreateContext (System.Type type, System.String startupAssemblyName) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.MigrationTool.AddMigration (System.String migrationName, System.String contextTypeName, System.String startupAssemblyName, System.String rootNamespace, System.String projectDir) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass11_0.<AddMigration>b__0 () [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.Program.Execute (System.String startupProject, System.Func`1 invoke) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.Program.AddMigration (System.String name, System.String context, System.String startupProject) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.Program+<>c__DisplayClass9_1.<Main>b__6 () [0x00000] in <filename unknown>:0 | |
at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute (System.String[] args) [0x00000] in <filename unknown>:0 | |
at Microsoft.Data.Entity.Commands.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 |
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.Data.Entity; | |
public class MyContext : DbContext | |
{ | |
public DbSet<Person> People { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder options) | |
{ | |
options.UseSqlite("Data Source=./console_app.sqlite"); | |
} | |
} | |
public class Person | |
{ | |
public int Id { get; set; } | |
public string FirstName { get; set; } | |
public string LastName { 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
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
using(var context = new MyContext()) | |
{ | |
context.Database.EnsureCreated(); | |
} | |
} | |
} |
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
{ | |
"dependencies": { | |
"EntityFramework.Commands": "7.0.0-*", | |
"EntityFramework.Sqlite": "7.0.0-*" | |
}, | |
"commands": { | |
"ef": "EntityFramework.Commands" | |
}, | |
"frameworks": { | |
"dnx451": {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment