Upgrading ASP.NET 5 beta-5 to beta-6
Here are some of the changes we had to make while upgrading our solution from beta-5 to beta-6. Most breaking changes were from Entity Framework and they were mostly renames. Thanks to Grant Goodart for tracking down all the renames. If you have anything to add to the list, be sure to mention it in the comments.
Column
has been renamed to HasColumnName
// beta-5
e.Property(x => x.Id).Column("MyID");
// beta-6
e.Property(x => x.Id).HasColumnName("MyID");
Table
has been renamed to ToTable
// beta-5
e.Table("tblUser");
// beta-6
e.ToTable("tblUser");
AsRelational().Connection
has been renamed to GetDbConnection()
// beta-5
var connection = _ctx.Database.AsRelational().Connection;
// beta-6
var connection = _ctx.Database.GetDbConnection();
DbConnection.CreateCommand()
has been renamed to CreateCommand()
// beta-5
var command = connection.DbConnection.CreateCommand();
// beta-6
var command = connection.CreateCommand();
ForSqlServer().UseIdentity()
has been renamed to UseSqlServerIdentityColumn()
// beta-5
entity.Property(u => u.Id)
.Column("UserIDNo")
.ForSqlServer()
.UseIdentity();
// beta-6
entity.Property(u => u.Id)
.Column("UserIDNo")
.UseSqlServerIdentityColumn();
StoreGeneratedPattern(StoreGeneratedPattern.Computed)
has been renamed to ValueGeneratedOnAddOrUpdate()
// beta-5
entity.Property(e => e.CustomerName)
.StoreGeneratedPattern(StoreGeneratedPattern.Computed);
// beta-6
entity.Property(e => e.CustomerName)
.ValueGeneratedOnAddOrUpdate();
DefaultExpression
has been renamed to DefaultValueSql
// beta-5
entity.Property(e => e.DateAltered)
.DefaultExpression("getdate()");
// beta-6
entity.Property(e => e.DateAltered)
.DefaultValueSql("getdate()");
DbContext
constructor now takes a DbContextOptions
parameter rather than an EntityOptions
parameter
// beta-5
public MyDbContext(EntityOptions options) : base(options)
// beta-6
public MyDbContext(DbContextOptions options) : base(options)
UseInMemoryStore
renamed to UseInMemoryDatabase
// beta-5
options.UseInMemoryStore(persist: false);
// beta-6
options.UseInMemoryDatabase(persist: false);