I am having trouble setting up my AR relationships.  I have tried so
many things, but nothing seems to work.  Here is what I am trying to
do.

Foo has many Journals.  Bar has many Journals. A Journal can belong to
either Foo or Bar.

If I try the mapping I have below, I get the following error

Castle.ActiveRecord.Framework.ActiveRecordException: ActiveRecord
tried to infer details about the relation Bar.Journals but it could
not find a 'BelongsTo' mapped property in the target type
Intel.TraX.Tests.Data.Store.Journal

I am probably way off on what needs to be done, but I am looking for
any help to point me in the right direction.

Thanks,
Jason

    [ActiveRecord]
    public class Journal : DomainObject<Journal>
    {
        [Any(typeof(Int32), MetaType = typeof(IJournalable),
TypeColumn = "JournalableType", IdColumn = "JournalableId", Cascade =
CascadeEnum.SaveUpdate)]
        [Any.MetaValue("Foo", typeof(Foo))]
        [Any.MetaValue("Bar", typeof(Bar))]
        public IJournalable Journalable { get; set; }
    }

    public interface IJournalable {}

    [ActiveRecord]
    public class Foo : DomainObject<Foo>, IJournalable
    {
        [HasMany(ColumnKey = "JournalableId")]
        public IList<Journal> Journals { get; set; }
    }

    [ActiveRecord]
    public class Bar : DomainObject<Bar>, IJournalable
    {
        [HasMany(ColumnKey = "JournalableId")]
        public IList<Journal> Journals { get; set; }
    }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" 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/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to