Hello,

I have an Account entity:

    public class Account : Entity
    {
        public virtual string Name { get; set; }

        protected Account() { }

        public Account(string accountName)
        {
            this.Name = accountName;
        }
    }

I'm trying to setup my entity so that it can have an (optional) parent
entity of type Account, and 0-to-many children of type Account. I'm
also trying to leverage the FNH automapper to have this work.

When I insert:
        public virtual Account Parent { get; set; }

the automapping works fine after I create the FK relationship in my
DB:

    Account
    ------------
    int AccountId
    int ParentFk
    nvarchar(100) Name

However, when I also insert:
        public virtual IList<Account> Children { get; set; }

my S#arp Architecture CanConfirmDatabaseMatchesMappings test fails
with the error:

NHibernate Mapping Exception: Repeated column in mapping for
collection: MyNamespace.Account.Children column: Account_id

I've found posts for mapping trees using an HBM file, as well as
Fluent NHibernate, but I can't figure it out using the automapping
feature.

--~--~---------~--~----~------------~-------~--~----~
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