NHibernate needs to proxy the collections, which means it has to be able to
subclass the type; this is why you typically only see interfaces exposed as
collections.
Your entity needs to just expose IList<T> or ISet<T>, and then you can tell
NHibernate to use your OrderLineCollection type (as long as it implements
UserCollectionType.
On Thu, Jul 30, 2009 at 7:22 PM, Jon Masters <[email protected]> wrote:
>
> nHibernate is giving the error : Custom type does not implement
> UserCollectionType: myApp.Domain.OrderLineCollection. BindingList
> implements IList, so why is nHibernate trying to use
> UserCollectionType instead of IList?
>
> public class OrderHeader
> {
> public virtual int OrderHeaderId { get; set; }
> public virtual string OrderNumber { get; set; }
> public virtual OrderLineCollection Line { get; set; }
> }
>
> public class OrderHeaderCollection : BindingList<OrderHeader> { }
>
> public class OrderHeaderMap : ClassMap<OrderHeader>
> {
> public OrderHeaderMap()
> {
> WithTable("Orders");
> Id(x => x.OrderHeaderId, "OrderId").GeneratedBy.Identity();
> Map(x => x.OrderNumber);
> HasMany(x => x.Line).WithKeyColumn("OrderHeaderId").AsList();
> }
> }
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---