entity framework - How to Migrate a Model on a separate schema -
i have following class want perform database migration on using ef6 in different schema.
namespace alphafrontendsiteasp.models { public class usercontext : dbcontext { public dbset<user> users { get; set; } public dbset<connection> connections { get; set; } } public class signalruser { [key] public string username { get; set; } public icollection<connection> connections { get; set; } } public class connection { public string connectionid { get; set; } public string useragent { get; set; } public bool connected { get; set; } } }
i ran add-migration signalrmodel signalrmodel name of migration , wants me work db columns:
public partial class signalrmodel : dbmigration { public override void up() { }
how do migration model database?
based on our quick twitter chat, think looking ef6's new capability handle multiple contexts per database. key need identify schema name of context hasdefaultschema. rather rewrite whole thing here in stackoverflow, hoe it's okay point existing content. here specs explain how works: https://entityframework.codeplex.com/wikipage?title=multi-tenant%20migrations. here's blog post wrote using feature ..specifying contexts, pointing same database, enabling migrations each model separately , adding /executing mingrations against 2 models. http://thedatafarm.com/data-access/digging-in-to-multi-tenant-migrations-with-ef6-alpha/
i highly recommend not using automatic migrations , following path of "code-based" migrations.
Comments
Post a Comment