ASP.NET vNext MVC and Entity Framework issues -
i'm trying create little asp.net vnext webapi + angularjs + entity framework project. obviously, lot changed in ef7 experiencing following issues:
i changed project.json following:
"dependencies": { "microsoft.aspnet.server.iis": "1.0.0-beta1", "entityframework": "7.0.0-beta1", "entityframework.sqlserver": "7.0.0-beta1", "entityframework.commands": "7.0.0-beta1", "microsoft.aspnet.mvc": "6.0.0-beta1", "microsoft.aspnet.diagnostics": "1.0.0-beta1", "microsoft.framework.configurationmodel.json": "1.0.0-beta1" in datacontext class, trying following:
using system; using project1.models; using microsoft.data.entity; namespace project1.dataaccess { public class datacontext { public dbset<website> websites { get; set; } public datacontext() { microsoft.data.entity.infrastructure.database.setinitializer(new dropcreatedatabaseifmodelchanges<datacontext>()); //database.setinitializer(new dropcreatedatabasealways<datacontext>()); } } } }
first of all: why has namespace system.data.entity changed microsoft.data.entity ? cannot find change in microsoft msdn article!!
second: whole database.setinitializer doesn't work anymore. recommends use microsoft.data.entity.infrastructure namespace database class doesn't contain setinitializer method.
because ef7 still in pre-release, won't find documentation on in msdn articles yet; you'll need @ ef7 github wiki information.
as try out ef7 please bear in mind stage in development of new ef codebase , there many features partially implemented or not yet available.
i believe setinitializer 1 of things has been implemented differently; team avoiding static methods in order improve testability of framework.
also note latest version of ef7 7.0.0-beta3, wiki provides information on how use nightly builds. (using nightly builds may rough given severe changes since vs2015 ctp6 released.)
Comments
Post a Comment