EntityFramework-Reverse-POCO-Code-First-Generator icon indicating copy to clipboard operation
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard

Supply SQL for computed columns

Open sjh37 opened this issue 5 years ago • 1 comments

Add computed columns SQL, so that migrations can fully create the database elsewhere. See MSDN

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Person>()
        .Property(p => p.DisplayName)
        .HasComputedColumnSql("[LastName] + ', ' + [FirstName]");
}

sjh37 avatar Jun 20 '20 23:06 sjh37

+1 for this feature. Have to now run a script after a migrate to create computed columns. Its a bit awkward.

Thanks Kevin

kcadduk avatar May 17 '21 21:05 kcadduk