2

我有以下课程:

public class Event
{
    public virtual Guid Id { get; set; }
    public virtual string UserName { get; set; }
    public virtual EventId EventId { get; set; }
}

public class EventId 
{
    public virtual Guid EventGuid {get; private set;}
}

我正在使用流畅的 NHibernate 自动映射来映射我的类,并在需要时覆盖特定属性。

类:事件在 s_typesToMap 中,类:EventId 在 s_components 中。

结果,我生成了下表:

create table "Event" (
   Id UNIQUEIDENTIFIER not null,
   UserName NVARCHAR(255) null,
   EventIdentifierEventGuid UNIQUEIDENTIFIER null,
   primary key (Id)
)

我想在 EventIdentifierEventGuid 上创建一个索引,它是 Event 组件中的一个属性。

我试图这样做:

.Override<Event>(obj => obj.Map(x => x.EventId.EventGuid).Index("EventId_index"))

当我生成 ddl 时,我得到以下信息:

create index EventId_index on "Event" (EventGuid)

预期结果应该是 EventIdentifierEventGuid 上的索引,而不是 EventGuid

我该怎么做?

4

0 回答 0