0
votes

Suppose I have following table:

 public class ResourcePossibleUm : EntityBase
    {
        public virtual bool IsMain { get; set; }
        public virtual double UmMass { get; set; }
        -------
    }

And mapping:

public class ResourcePosibleUMMap : ClassMap<ResourcePossibleUm>
    {
        public ResourcePosibleUMMap()
        {
            Id(x => x.Id).GeneratedBy.Identity();           
            Map(x => x.IsMain);
            Map(c => c.UmMass);
        }
    }

Id is primary key if ResourcePossibleUM table , and non clustered index for this table.Now I want to set clustered index column ["IsMain"] and I really can't find how to do this. Any help will be depreciated .Thanks a lot!

1
I believe the answer can be found here: stackoverflow.com/questions/1356467/…Cole W
I saw this answer but I can't figure out how to do this in fluent mapping, or how to mix fluent mapping with traditional Nhibernate mapping...Nic

1 Answers

0
votes

You cannot do a CLUSTERED index with Fluent. You can do a "compound" Index....(non clustered)....

Generic example below: (The key being to use the same name... twice. "IX_Employee_EmployeeUUID_And_SSN" in the example below)

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);