Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 763 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 763 Bytes

EntityFramework.Conventions

Conventions for EnitityFramework 6.x

using System.Data.Entity;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.ModelConfiguration.Conventions;

public class BlogContext : DbContext  
{  
    public DbSet<Post> Posts { get; set; }  
    public DbSet<Comment> Comments { get; set; }  
    
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);

        modelBuilder.Conventions.Add<SnakeCaseStoreModelConvention>();
        modelBuilder.Conventions.Add<LowerCaseTableNameConvention>();
        modelBuilder.Conventions.Add<SnakeCaseColumnNameConvention>();
    }
}