OK. This is a stripped down test case, not the original code. The crux
seems to be the subclassing:

The entities:
namespace FNH_Repro.Entities
{
    public class ThingBase : Entity
    {
    }

    public class SpecificThing : ThingBase
    {
        public virtual ARelatedThing RelatedThing { get; set; }
    }

    public class ARelatedThing : Entity
    {
    }
}

The config:
            var autoMappings =
AutoPersistenceModel.MapEntitiesFromAssemblyOf<ThingBase>()
                .WithSetup(setup => setup.IsBaseType = type => type ==
typeof(Entity))
                .Where(t => t.Namespace == "FNH_Repro.Entities");

            FluentConfiguration config = Fluently.Configure()
              .Database(
                FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2005
                .ConnectionString(c => c.Server("localhost").Database
("ScratchDB").TrustedConnection())
              )
              .Mappings(m => m.AutoMappings.Add(autoMappings).ExportTo
(@".\"));





On Apr 27, 2:38 pm, Hudson Akridge <hudson.akri...@gmail.com> wrote:
> Your best bet is to just post your Class data definitions (all required for
> mapping) and your configuration statements used for any conventions or the
> like you used when you configured fluent to automap; all as text.
>
> On Mon, Apr 27, 2009 at 3:39 PM, Kevin Dente <kevinde...@gmail.com> wrote:
>
> > I have a simple repro case for this (VS project), but I'm not sure how
> > to post it. Does Google Groups not support attachments?
>
> > On Apr 27, 2:12 am, James Gregory <jagregory....@gmail.com> wrote:
> > > Yeah, we need some more info. What's your automapping setup? What does
> > this
> > > particular entity look like? What's the property in question?
>
> > > On Mon, Apr 27, 2009 at 9:50 AM, Andrew Stewart <
> > andrewnstew...@gmail.com>wrote:
>
> > > > Hi Kevin
> > > > I'm not sure why that should of happened, can you give us your
> > > > configuration and your example to look at:
>
> > > > Cheers
>
> > > > Andy
>
> > > > On Sun, Apr 26, 2009 at 10:47 PM, MaggiePlusPlus <
> > > > maggielongsh...@gmail.com> wrote:
>
> > > >> I am using AutoMap exclusively as well (but am also very new at
> > > >> this).  I have gotten the Many-to-one mapping without changing
> > > >> manyToOnePart.write.
>
> > > >> in the parent class I have:
> > > >> public virtual IList<Child> Children { get; set; }
>
> > > >> in child class I have:
> > > >> public virtual Parent Parent { get; set; }
>
> > > >> parent xml:
>
> > > >>    <bag name="Children " inverse="true">
> > > >>      <key column="FK_Parent" />
> > > >>      <one-to-many class="IPCApplication.Entities.Model.Child,
> > > >> IPCApplication.Entities, Version=1.0.0.0, Culture=neutral,
> > > >> PublicKeyToken=null" />
> > > >>    </bag>
>
> > > >> child xml:
>
> > > >>  <many-to-one name="Parent" column="FK_Parent" />
>
> > > >> I also am using conventions to name the foreign keys and add the
> > > >> inverse attribute - but the mapping was correct before I added that.
>
> > > >> Is this what you were trying to do?
>
> > > >> On Apr 24, 5:38 pm, Kevin Dente <kevinde...@gmail.com> wrote:
> > > >> > FWIW, I was able to get past this by changing ManyToOnePart.Write. I
> > > >> > changed
> > > >> > if (_columns.Count == 0)
> > > >> > to
> > > >> > if ((_columns.Count == 0) && !String.IsNullOrEmpty(columnName))
>
> > > >> > No idea if this is the "correct" fix, but it let me get past the
> > > >> > block.
>
> > > >> > On Apr 24, 11:04 am, Kevin Dente <kevinde...@gmail.com> wrote:
>
> > > >> > > I'm fairly green with NHibernate and FNH, so hopefully this isn't
> > a
> > > >> > > totally dumb question.
>
> > > >> > > I'm trying to fully automap a set of classes. One of the
> > properties
> > > >> > > results in a many-to-one mapping, but the resulting mapping XML
> > has no
> > > >> > > column name associated with the property (that is, the attribute
> > is
> > > >> > > there but blank), which makes NHibernate barf. Is this ever a
> > > >> > > reasonable thing to expect it to do? Am I missing something
> > obvious?
>
> > > > --
> > > > =================
> > > > I-nnovate Software - Bespoke Software Development, uk wirral.
> > > >http://www.i-nnovate.net
>
> > > > Easy Project Managment Online
> > > >http://www.task-mate.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@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