假设我有以下表格:
public class ResourcePossibleUm : EntityBase
{
public virtual bool IsMain { get; set; }
public virtual double UmMass { get; set; }
-------
}
并映射:
public class ResourcePosibleUMMap : ClassMap<ResourcePossibleUm>
{
public ResourcePosibleUMMap()
{
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.IsMain);
Map(c => c.UmMass);
}
}
Id是主键,如果ResourcePossibleUM表,以及此表的非聚集索引。现在我想设置聚簇索引列[“IsMain”],我真的找不到如何做到这一点。任何帮助都会被折旧。谢谢你!
答案 0 :(得分:0)
你不能用Fluent做一个CLUSTERED索引。你可以做一个&#34;复合&#34;索引......(非聚集的)....
以下通用示例: (关键是使用相同的名称......两次。&#34; IX_Employee_EmployeeUUID_And_SSN&#34;在下面的例子中)
public class EmployeeMap : ClassMap<EmployeeNHEntity>
{
public EmployeeMap()
{
Schema("dbo");
Table("Employee");
Id(x => x.EmployeeUUID).GeneratedBy.GuidComb().Index("IX_Employee_EmployeeUUID_And_SSN");
Map(x => x.SSN).Index("IX_Employee_EmployeeUUID_And_SSN");
Map(x => x.LastName);
Map(x => x.FirstName);