Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Issue: Schema partitioning breaks on fresh Databases [524]

$
0
0
when the migrations database is changed in the DbContext and application runs before migrations are enabled, initial Update-Database fails<br /><br />Repro steps:<br />Create sample app, edit BlogContext.cs overriding OnModelCreate (see below)<br />run application<br />PM> Enable-Migrations<br />PM> Add-Migration m0<br />PM> Update-Database <br />error: There is already an object named 'Posts' in the database.<br /><br />public class BlogContext : DbContext {<br /> protected override void OnModelCreating(DbModelBuilder modelBuilder)<br /> {<br /> modelBuilder.HasDefaultSchema("__NewMigrationHistory");<br /><br /> }<br /><br /> public DbSet<Post> Posts { get; set; }<br /> public DbSet<Comment> Comments { get; set; }<br /> }<br /><br />

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>