I've just decided to try out FNH's automapping for the first time on my
current project and have run into what sounds like the exact same issue as
the one described
here<http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/696514c66a17ff5e/f03e7de7e155b36b?lnk=gst&q=inverse+automapping#f03e7de7e155b36b>.
I've got a unidirectional one-to-many relationship between a Parent and
Child where my Parent looks something like so:

public class Parent
{
    public virtual int Id { get; set; }
    public virtual IEnumerable<Child> Children { get; set; }
}

and my Child looks like so:

public class Child
{
    public virtual int Id { get; set; }
    // other properties (does not reference parent)
}

I'm also registering the following convention:

    public class HasManyConvention : IHasManyConvention
    {
        public void Apply(IOneToManyCollectionInstance instance)
        {
            instance.Key.Column(instance.EntityType.Name + "_Id");
            instance.Cascade.All();
        }
    }


When creating a new Parent and adding new instances of Child to the Children
collection and then saving, the Parent and Child tables are populated, but
the foreign key column in the Child table is null.  An issue mentioned in
the referenced thread was that cascade all wasn't being used, but I've got
that set.  What am I missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to