Dear, I have parent class "ABCClassification" and child class "ABCClass", the parent class have entity set of the child class and I have values in both and then I add property of parent class in the child and adding "PairTo" relation on the entity set then when display the parent data I found it has no child although I added it before using "PairTo"!!! why???

asked Jun 07 '11 at 05:03

Hala%20Aly's gravatar image

Hala Aly
7779

Please attach source code of these two entities.

(Jun 07 '11 at 06:04) Peter Šulek Peter%20%C5%A0ulek's gravatar image

One Answer:

Dear Peter, First thanks for your concern, and below the two classes after adding pair to. To get the classes before changes find the my comments that will tell you what to remove. [HierarchyRoot]

[Index("Code", Unique = true)]    
public class ABCClassification : BasicDefinition
{
    //Remove PairTo to get old version
    [Field]
    [Association(OnOwnerRemove = OnRemoveAction.Cascade, OnTargetRemove = OnRemoveAction.Clear, PairTo = "ABCClassification")]
    public EntitySet<ABCClass> Values { get; private set; }

}
[HierarchyRoot]

[Index("Code", Unique = true)]    
public class ABCClass : BasicDefinition
{

    [Field]
    public string ClassificationColor
    {
        get;
        set;
    }

    [Field(Nullable=false)]
    public decimal Percentage
    {
        get;
        set;
    }

    //Remove this to get old version
    [Field]
    public ABCClassification ABCClassification
    {
        get;
        set;
    }

}

answered Jun 07 '11 at 13:03

Hala%20Aly's gravatar image

Hala Aly
7779

edited Jun 07 '11 at 13:06

I could not get an error you describe, maybe i don't understand well. Please look at demo i made here and run, everything seems ok. Try to modify my sample to have error you describe.

(Jun 09 '11 at 02:40) Peter Šulek Peter%20%C5%A0ulek's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×3

Asked: Jun 07 '11 at 05:03

Seen: 2,176 times

Last updated: Jun 09 '11 at 02:40

powered by OSQA