I agree, a base class would be better, but a common base class isn't possible in this situation.
The interface itself is explicitly mapped. This is something thats fully supported in NHibernate, should it not be supported here too? 2009/10/21 Eric Ridgeway <[email protected]> > If you were to use an actual base class and not an interface this would > work. The intent is to generate maps for subclasses not interface > implementers. > > On Oct 21, 2009 3:29 AM, "Robert Byrne" <[email protected]> wrote: > > > With a (pretty simplified) model like the following: > > public interface IAssignee { > int Id { get; set; } > } > > public class User : IAssignee { > //other properties > } > > public class Group : IAssignee { > //other properties > } > > Im mapping it along these lines: > > public class AssigneeMap : ClassMap<IAssignee> { > public AsigneeMap() { > Table("Assignee"); > Id(e => e.Id); > } > } > > public class UserMap : SubclassMap<User> { > public AsigneeMap() { > Table("User"); > KeyColumn("Id"); > //other mappings.. > } > } > > public class GroupMap : SubclassMap<Group> { > public AsigneeMap() { > Table("Group"); > KeyColumn("Id"); > //other mappings.. > } > } > > The problem is that the two subclass mappings are not being included > in the generated mapping xml. I've tracked this down (I think) to > SeperateSubclassVisitor.cs. The method SortByDistanceFrom doesn't seem > to work if the parent type is an interface. > > Would there by any problems adding a check around line 87 in that > class that special cases this situation. That is, if the parent type > is an interface, and the subclass providers type implements it, assume > that theres a relationship with a 'distance' of 0 between them? > > > > > > -- Regards, Robert Byrne, CTO, Iceberg www.geticeberg.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. 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/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
