我为我的NHibernate数据库模型定义了一个复合id。它似乎工作,但我不能为一个键属性设置生成器。
是否可以在composite-id中为key-proper定义生成器?
C#NHibernate模型
public const string STR_ID = "Id";
public const string STR_SHARDKEY = "ShardKey";
[CompositeId(-4)]
[KeyProperty(-3, Name = STR_ID, Column = STR_ID)]
[KeyProperty(-2, Name = STR_SHARDKEY , Column = STR_SHARDKEY )]
[Generator(-1, Class = "guid.comb")]
public virtual Guid? Id { get; set; }
[Column(Name = STR_SHARDKEY )]
public virtual int ShardKey{ get; set; }
XML映射
<composite-id>
<key-property name="Id" column="Id" />
<key-property name="ShardKey" column="ShardKey" />
</composite-id>
不应该在某处有<generator class="guid.comb" />
这样的生成器标签吗?