English 中文(简体)
Does Fluent NHibernate support "trigger-identity"
原标题:

I posted the question in the Fluent-NHibernate newgroup but so far there has been no answer from the void.

Is there a Fluent NHibernate mapping for the NHibernate "trigger-identity" method of generating primary keys.

Thanks

问题回答

Just to keep this discussion up-to-date :

this.Id(x => x.Id, "id").GeneratedBy.TriggerIdentity();

-> Fluent NHibernate V.1.1.0.685

Try this:

this.Id(x => x.Id).Column("ID").GeneratedBy.Custom("trigger-identity");

So it turns out that trigger-identity is not currently supported.

So far, the only solution I ve found is to use an hbm.xml file for those entities that require trigger-identity generators. However, we ran into another problem when using trigger-identity and "long" ids and our Oracle database . There is a bug where NHibernate does not translate the Id values returned from properly. Here is the JIRA entry:

https://nhibernate.jira.com/browse/NH-1893

I have tried with FluentNHibernate v2.0.50727

Following mapping works fine: this.Id(x => x.Id, "id").GeneratedBy.TriggerIdentity();

Following mapping is not supported anymore: this.Id(x => x.Id).Column("ID").GeneratedBy.Custom("trigger-identity");





相关问题
Does Fluent NHibernate support "trigger-identity"

I posted the question in the Fluent-NHibernate newgroup but so far there has been no answer from the void. Is there a Fluent NHibernate mapping for the NHibernate "trigger-identity" method of ...

automapping nested components naming conventions

Im making the switch from Fluent Mapping to Automapping in my current project. If I have the following domain: public class Matter{ public Client Client{get;set;} } public class Client { ...

NHibernate Search in a List using ICriteria

I have my class X : public class ClassX { public virtual IList<ClassY> ListY { get; set; } ... } My ClassX mapping (using Fluent) ... HasMany<ClassX>(x => x.ListY ) ....

Fluent nHibernate keeps recreating my database, why?

I m trying to convert my data layer from Linq2Sql to nHibernate. I think Xml the configuration in nHibernate is pretty backwards so I m using Fluent. I ve managed to get fluent, add in a repository ...

How to fluent-map this (using fluent nhibernate)?

I have two tables in my database "Styles" and "BannedStyles". They have a reference via the ItemNo. Now styles can be banned per store. So if style x is banned at store Y then its very possible that ...

热门标签