Hello,

I'm sure this has been asked a dozen times or more, but I am having a
devil of a time persuading FNH to behave with my table-per-subclass
inheritance hierarchy strategy.

It may be partially due to an Id strategy I've got in place, which
says 'Type' + "Id", but I don't know for sure.

To compound interest, I've also got some custom subsequent domain
models which depend on the hierarchy, but which are getting confused
over the "Id" they are looking for.

Say I've got the prototypical:

class Base { public virtual long Id { get; set; } }
class One : Base {}
class Two : Base{}

I've got [Id] mapped to Base table, and One and Two [Id]s as PK, also
FK referencing Base table. After persuading the SCM to use "Id" for
its KeyColumn, so far so good.

When I try to SaveOrUpdate an instance of One or Two, though, I am
receiving NonUniqueObjectException, which I figure has something to do
with the fact that two tables are involved, but I can't say for sure.

Up to that point I would either stumble on the Id's disagreeing, or
wanting a non-KeyColumn Id, which is also incorrect. I'm not sure how
that aligns with the domain model, single Id, for example. It must be
the same column name(s), I believe, for that to make any sense
whatsoever.

I've tried following the examples to no avail. I'm sure when the AHA
moment occurs, it will be obvious.

I am using VS22013 Update 4 + FNH 1.4.0.0 + NH 3.3.4.4000 + targeting .NET 4.5

Best regards,

Michael Powell

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/d/optout.

Reply via email to