开发者

Help making Fluent NHibernate create an oracle sequence for each table

I am using Fluent NHibernate's (1.0 RTM) automapping feature to create my oracle database schema. My iss开发者_运维知识库ue is that all the tables are using a single "hibernate-sequence", whereas I would prefer (and my boss would demand) a sequence generator for each table.

Any ideas?


Managed to solve my own solution. Here's the code:

public class OraclePrimaryKeySequenceConvention : IIdConvention
{
    public void Apply(IIdentityInstance instance)
    {
        instance.GeneratedBy.Sequence(string.Format("Sequence_{0}",
                                                    instance.EntityType.Name));
    }
}

Yay. :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜