I'm using the Fluent automapper to generate a database from some very 
simple domain entities that look like this:

public class Customer
{
public virtual int Id { get; set; }
public virtual IList<Order> Orders { get; set; }
}

Everything works fine until I add a custom convention to the persistence 
model:

var persistenceModel = AutoMap
.AssemblyOf<Customer>(entityConfigs)
.Conventions.Add<CollectionConvention>();

The convention I'm adding is supposed to create an ObservableListType (from 
unhaddins) wherever an IList appears:

public class CollectionConvention : ICollectionConvention
{
public void Apply(ICollectionInstance instance)
{
Type collectionType = typeof(ObservableListType<>)
.MakeGenericType(instance.ChildType);
instance.CollectionType(collectionType);
 }
}

As soon as I do this lazy loading immediately breaks, which appears to be 
the result of malformed SQL from NHibernate:

SELECT orders0_.Customer_id as Customer2_1_, orders0_.Id as Id1_, 
orders0_.Id as Id1_0_, orders0_.Customer_id as Customer2_1_0_ FROM [Order] 
orders0_ WHERE orders0_.Customer_id=?

I've created a test project demonstrating this 
problem<http://www.ppl-pilot.com/files/NHibernateTest.zip>, 
is anyone able to tell me what I'm doing wrong and what I need to do to get 
custom collections working without breaking lazy loading? Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fluent-nhibernate+unsubscr...@googlegroups.com.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
Visit this group at http://groups.google.com/group/fluent-nhibernate.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to