c# - Dot Net Entity Framework database update doesn't create tables in mysql database -
i'm using mysql
database official connection provider. i'm trying next project example (asp.net core 1.0) on mac:
public class bloggingcontext : dbcontext { public bloggingcontext(dbcontextoptions<bloggingcontext> options) : base(options) { } public dbset<blog> blogs { get; set; } public dbset<post> posts { get; set; } } public class blog { public int blogid { get; set; } public string url { get; set; } public list<post> posts { get; set; } } public class post { public int postid { get; set; } public string title { get; set; } public string content { get; set; } public int blogid { get; set; } public blog blog { get; set; } }
and in startup.cs
public void configureservices(iservicecollection services) { var connection = @"server=localhost;userid=efcore;port=3306;database=blogsfinal;sslmode=none;"; services.adddbcontext<bloggingcontext>(options => options.usemysql(connection)); // add framework services. services.addmvc(); }
in project.json add
"dependencies": { ... "mysql.data.entityframeworkcore": "7.0.5-ir21", "microsoft.entityframeworkcore.tools": { "version": "1.0.0-preview2-final", "type": "build" } }
and
"tools": { ..., "microsoft.aspnetcore.server.iisintegration.tools": "1.0.0-preview2-final" },
when run dotnet ef migrations add v1
, works fine , creates migration files, when execute dotnet ef database update
database created tables not , throws output
system.notimplementedexception: method or operation not implemented. @ mysql.data.entityframeworkcore.migrations.internal.mysqlhistoryrepository.get_existssql() @ microsoft.entityframeworkcore.migrations.historyrepository.exists() @ microsoft.entityframeworkcore.migrations.historyrepository.getappliedmigrations() @ microsoft.entityframeworkcore.migrations.internal.migrator.migrate(string targetmigration) @ microsoft.entityframeworkcore.design.migrationsoperations.updatedatabase(string targetmigration, string contexttype) @ microsoft.entityframeworkcore.tools.cli.databaseupdatecommand.<>c__displayclass0_0.<configure>b__0() @ microsoft.extensions.commandlineutils.commandlineapplication.execute(string[] args) @ microsoft.entityframeworkcore.tools.cli.program.main(string[] args) method or operation not implemented.
exceptions says it. official mysql provider oracle doesn't support migrations or scaffolding yet.
it create database on first execution of context.database.ensurecreated()
. changes done after that, won't applied. have drop whole db , create new one, losing data.
say oracle ;)
update
with release of 7.0.6-ir31 package migrations work, scaffolding still doesn't.
Comments
Post a Comment