给定以下 POCO 类:
public class Certification {
public int Id { get; set; }
public virtual ICollection<Employee> CertifiedEmployees { get; set; }
}
public class Employee {
public int Id { get; set; }
public virtual ICollection<Certification> Certifications { get; set; }
}
使用 EF4 CTP4 代码优先方法创建数据库模型确实会创建所需的联结表:
CREATE TABLE [dbo].[Certifications_CertifiedEmployees](
[Certifications_Id] [int] NOT NULL,
[CertifiedEmployees_Id] [int] NOT NULL,
...
但是,表名和列名并不理想,因为它们是从关联的类属性名生成的。我宁愿有:
CREATE TABLE [dbo].[Employees_Certifications](
[Employee_Id] [int] NOT NULL,
[Certification_Id] [int] NOT NULL,
...
有谁知道在这种情况下是否可以更改生成的列名,并且可以选择更改表名,以便员工在认证之前?
谢谢,加里