I'm trying to use ReferencesAny() to map a polymorphic property. public class Payment { public virtual PaymentDetails PaymentDetails { get; set; } }
I'm using auto-mapping with a mapping override defined as follows: mapping.ReferencesAny(x => x.PaymentDetails) .EntityTypeColumn("PaymentMethodID") .EntityIdentifierColumn("PaymentDetailID") .IdentityType<int>() .AddMetaValue<PaymentDetailsCreditCardEGate>("1") .AddMetaValue<PaymentDetailsCreditCardEftPos>("2") .AddMetaValue<PaymentDetailsCash>("3") .AddMetaValue<PaymentDetailsMoneyOrder>("4") // etc .Cascade.SaveUpdate(); PaymentDetails is an empty base class (I'd originally tried using an IPaymentDetails interface, but read that this was advised against) from which PaymentDetailsCreditCardEGate, PaymentDetailsCreditCardEftPos, etc inherit. With the above mappings, I get the following exception: NHibernate.MappingException: Duplicate property mapping of PaymentDetails found in Xtend.Core.Payments.Payment I can't see where the duplicate mapping would be coming from. I did wonder if there was a problem with the base class not being mapped to a table, but if I add the following: mappings.IgnoreBase<PaymentDetails>(); then I get the following exception: NHibernate.MappingException: An association from the table Payments refers to an unmapped class: Xtend.Core.PaymentDetails Can anyone see where I'm going wrong? Is there anyway of inspecting the xml that Fluent NHibernate is trying to generate? -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.