Mapping a recursive generic base class.

gboyah's Avatar

gboyah

16 Jul, 2010 05:20 PM via web

I want to have a DRY approach to adding commenting abilities to all entities.
Imagine the following (simplified)

public class BaseComment

    where TItem : BaseEntity

{

  public virtual TItem CommentedItem {get; set;}
  public virtual User User {get; set;}
  public virtual string Comment {get; set;}
  public IList<BaseComment<TItem>> Replies {get; set;}

}

public class EventComment : BaseComment
{ }

public class VenueComment : BaseComment
{ }

All works well if i don't map the Replies property. When i do, i get

Association references unmapped class: SocialDance.Core.Domain.BaseComment`1[[SocialDance.Events.Domain.Venue, SocialDance.Events, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]

    Reply to this discussion

    Preview Comments are parsed with Markdown. Help with syntax

    Attached Files

      You can attach files up to 10MB

      What is 14 minus 4?