Hello again, We're closer to product completion, and are coming across this issue again. Would love to know if the above is by design, and how we may be able to overcome the problem with ComposedId made up of superclass properties.
Will be grateful for any advice at all. Regards, Dawid Ciecierski On Wednesday, August 29, 2012 11:22:54 AM UTC+2, Dawid Ciecierski wrote: > > Hello, > > This question was posted on StackOverflow <http://goog_632167627>, but > expanding on it here. I'm having trouble understanding NHibernate behaviour > when mapping subclasses, and would like to ask you for help as I cannot > determine if what I'm seeing is misconfiguration on my part or a bug - with > my limited knowledge of mapping by code and NHibernate > > We're loosely following DDD principles, and have a simple base class for > all of our aggregate roots (main business objects). This base class has no > meaning of itself, and therefore is declared abstract and is not mapped. > Only the inheriting specific classes are mapped, also mapping properties > inherited from the base abstract class. > > A problem arises when we try to combine an inherited property with a > property declared on the concrete class into a composed id like so: > > public class BaseClass > { > public int InheritedId { get; set; } > } > > public class Subclass : BaseClass > { > public int OwnId { get; set; } > } > > public class SubclassMap : ClassMapping<Subclass> > { > public SubclassMap() > { > Table("Subclass"); > ComposedId(x => { > x.Property(p => p.InheritedId); > x.Property(p => p.OwnId); > }); > } > } > > Given the above mapping, explicit model mapper only maps OwnId to be the > primary key of the table, skipping on the InheritedId. As I said before, > it may be a bug (as suggested on StackOverflow) or perhaps NHibernate needs > some clear instructions that I'm trying to use implicit polymorphism? If it > is the latter, how do I do that with Loquacious? > > Kind regards, > Dawid Ciecierski > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/gDfSpSOUq2kJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
