Hi,

I'm using ActiveRecord and trying to configure an object hierarchy
that utilises table-per-class at the top and single-table-inheritance
deeper in the tree. Upon initializing ActiveRecord, I'm getting the
exception message "The 'discriminator-value' attribute is not
declared."

My class hierarchy is:

    [ActiveRecord, JoinedBase]
    public abstract class Animal : ActiveRecordBase
    {
        [PrimaryKey]
        public int Id { get; private set; }

        [Property]
        public int Age { get; set; }

        [Property]
        public string Name { get; set; }
    }

    [ActiveRecord]
    public class Python : Animal
    {
        [JoinedKey]
        public int AnimalId { get; private set; }

        [Property]
        public int Length { get; set; }
    }

    [ActiveRecord]
    public class Barracuda : Animal
    {
        [JoinedKey]
        public int AnimalId { get; private set; }

        [Property]
        public string Colour { get; set; }
    }

    [ActiveRecord(DiscriminatorColumn = "Type", DiscriminatorType =
"String", DiscriminatorValue="Mammal")]
    public abstract class Mammal : Animal
    {
        [JoinedKey]
        public int AnimalId { get; private set; }

        [Property]
        public int GestationPeriodDays { get; set; }
    }

    [ActiveRecord(DiscriminatorValue="Elephant")]
    public class Elephant : Mammal
    {
        [Property]
        public int TuskLength { get; set; }
    }

    [ActiveRecord(DiscriminatorValue = "Human")]
    public class Human : Mammal
    {
        [Property]
        public string HairColour { get; set; }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to