How to specify table name with Entity Framework Code First Fluent API
You can also use the Table annotation:
[Table("InternalBlogs")]
public class Blog
See: Code First Data Annotations
You'll use the .ToTable()
method:
modelBuilder.Entity<Department>().ToTable("t_Department");
Source: MSDN: http://msdn.microsoft.com/en-us/data/jj591617.aspx
Use ToTable method:
public class MyEntityMap : EntityTypeConfiguration<MyEntity>
{
public const string TableName = "MyEntity";
public MyEntityMap()
{
ToTable(TableName);
Property(t => t.Id);
}
}