-
To specify the name of the database table, you can use an attribute or the fluent API:
Using Attributes:
[Table("MyAccountsTable")] public class Account { public string PasswordHash { get; set; } }Using Fluent API:
public class YourContext : DbContext { protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Language>(entity => { entity.ToTable("MyAccountsTable"); }); } } -
To name your columns manually, it’s very similar and you can use an attribute or the fluent API:
Using Attributes:
public class Account { [Column("MyPasswordHashColumn")] public string PasswordHash { get; set; } }Using Fluent API:
public class YourContext : DbContext { protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Language>(x => x .ToTable("MyAccountsTable") .Property(entity => entity.PasswordHash) .HasColumnName("MyPasswordHashColumn") ); } }