c# - Enable Migrations with Context in Separate Assembly? -
i have 1 project want run update-database
against have models , context in separate project.
if run enable-migrations
error: no context type found in assembly 'myproject'.
this presumably because context in myproject.mvc.
if run enable-migrations
against myproject.mvc have add app config file. don't want want use code across many projects.
so can run enable-migrations
against myproject , somehow tell in myproject.mvc context?
this work in ef 6, there release added -contextprojectname
parameter -enable-migrations
command. using command following:
enable-migrations -contextprojectname myproject.mvc -startupprojectname myproject.mvc -contexttypename myproject.mvc.mycontextfolder.mycontextname -projectname myproject
this add migrations myproject
project using context in myproject.mvc
. need make sure project migrations has reference project context, i.e., myproject
references myproject.mvc
Comments
Post a Comment