Friday, 15 April 2011

entity framework - "k ef migration add test" gives exception when using code first migrations in asp.net vNext -



entity framework - "k ef migration add test" gives exception when using code first migrations in asp.net vNext -

i'm not sure if supposed work yet, couldn't find much info this. i'm running command

k ef migration add together test

in effort enable migrations code first model. exception is:

system.typeloadexception: method 'next' in type 'microsoft.data.entity.sqlserver .sequentialguidvaluegenerator' assembly 'entityframework.sqlserver, version =7.0.0.0, culture=neutral, publickeytoken=null' not have implementation.

this implies isn't implemented yet, find hard believe. maybe i'm doing wrong?

the project utilize created vs2014 ctp3 , set utilize core clr. project.json:

{ "webroot" : "wwwroot", "exclude": "wwwroot/**/*.*", "dependencies": { "entityframework.sqlserver": "7.0.0-alpha4", "microsoft.aspnet.mvc": "6.0.0-alpha4", "microsoft.aspnet.identity.sqlserver": "3.0.0-alpha4", "microsoft.aspnet.identity.authentication": "3.0.0-alpha4", "microsoft.aspnet.security.cookies": "1.0.0-alpha4", "microsoft.aspnet.server.iis": "1.0.0-alpha4", "microsoft.aspnet.server.weblistener": "1.0.0-alpha4", "microsoft.aspnet.staticfiles": "1.0.0-alpha4", "microsoft.framework.configurationmodel.json": "1.0.0-alpha4", "microsoft.visualstudio.web.browserlink.loader": "14.0.0-alpha4", "entityframework.commands": "7.0.0-*" }, "commands": { /* alter port number when self hosting application */ "web": "microsoft.aspnet.hosting --server microsoft.aspnet.server.weblistener --server.urls http://localhost:5000", "ef": "entityframework.commands" }, "frameworks": { "aspnet50" : { }, "aspnetcore50" : { } }

}

i thought maybe versioning problem, changed ef reference this:

"entityframework.sqlserver": "7.0.0-*"

which gives me exception on migrations command:

system.exception: todo: no service type 'microsoft.data.entity.migrations.modeldiffer' has been registered.

which guess improve exception get, couldn't find on how prepare this. available musicstore sample not utilize migrations.

update

the context , model:

public class mycontext : dbcontext { public dbset<mymodel> mymodels { get; set; } protected override void onconfiguring(dbcontextoptions options) { var configuration = new configuration(); configuration.addjsonfile("config.json"); options.usesqlserver(configuration.get("data:defaultconnection:connectionstring")); base.onconfiguring(options); } } public class mymodel { public int mymodelid{ get; set; } public string name { get; set; } }

startup:

public class startup { public void configure(iapplicationbuilder app) { // setup configuration sources var configuration = new configuration(); configuration.addjsonfile("config.json"); configuration.addenvironmentvariables(); // set application services app.useservices(services => { // add together ef services services container services.addentityframework().addsqlserver(); // add together mvc services services container services.addmvc(); }); // enable browser link back upwards app.usebrowserlink(); // add together static files request pipeline app.usestaticfiles(); } }

maybe important, i'm running on windows 10 technical preview.

update 2

maybe of import versioning problems, nuget.config:

class="snippet-code-html lang-html prettyprint-override"><?xml version="1.0" encoding="utf-8"?> <configuration> <packagesources> <add key="aspnetvnext" value="https://www.myget.org/f/aspnetvnext/" /> <add key="nuget.org" value="https://nuget.org/api/v2/" /> </packagesources> <packagesourcecredentials> <aspnetvnext> <add key="username" value="aspnetreadonly" /> <add key="cleartextpassword" value="4d8a2d9c-7b80-4162-9978-47e918c9658c" /> </aspnetvnext> </packagesourcecredentials> </configuration>

asp.net entity-framework asp.net-core entity-framework-core

No comments:

Post a Comment