I'm having issues with a One To Many relationship using Fluent NHibernate. I've read the following question but I think my situation is simpler than that, so maybe I can avoid implementing IUserCollectionType.
I have a Project, and a Project has ProductBacklog. A ProductBacklog is a List of UserStory.
public class Project
{
public virtual int Id { get; set; }
public virtual ProductBacklog Backlog { get; protected set; }
}
public class ProductBacklog : List<UserStory>
{
}
When I try to map:
public class ProjectMapping : ClassMap<Project>
{
public ProjectMapping()
{
Id(x => x.Id).GeneratedBy.Identity();
HasMany(x => x.Backlog).KeyColumn("ProjectId");
}
}
I get the following error:
NHibernate.MappingException: Custom type does not implement UserCollectionType: ScrumBoard.Domain.ProductBacklog
If Project.Backlog is a List instead of being of type ProductBacklog, it will work:
public class Project
{
public virtual int Id { get; set; }
public virtual List<UserStory> Backlog { get; protected set; }
}
Is there any way to tell to Fluent NHibernate how to do the mapping without implementing IUserCollectionType?
Thanks in advance!