entity framework - EF Migrations in Hierarchy -
i'm using entity framework multiple existing databases in hierarchy.
- 1x parent
- 3x children
i aim have 2 database contexts, 1 support parent , 1 support children. intend have automatic migrations setup , enabled on both contexts.
my child contexts pass in connection string name determine child connection create
/// <summary> /// represents child database context within hierarchy /// </summary> public class childdbcontext : dbcontext { public childdbcontext(string name) : base(name) { database.setinitializer(new migratedatabasetolatestversion<childdbcontext, migrations.configuration>()); } }
question
will automatic migrations update each child database first time accessed i.e first time new childdbcontext("child1")
, new childdbcontext("child2")
, new childdbcontext("child3")
?
i'm not 100% sure when migration check performed or whether work without parameterless contructor.
ef determines whether database needs initialized checking dictionary key generated connection type , connection string. migrations should performed each database.
see initializedatabaseaction
in system.data.entity.internal.lazyinternalcontext
Comments
Post a Comment