开发者

Composition of composition not working

I am currently using RIA services with an object containing a child containing itself a child and it's not working :-( !

I have an update method for the BaseObject and the FirstChild are correctly present in the client but it behaves as if I have no SecondChild object (the type is not event created on the client)...

Here are the classes:

[MetadataType(typeof(BaseObjectMetaData))]
public partial class BaseObject 
{ 
    internal class 开发者_StackOverflow社区BaseObjectMetaData
    {
        [Include, Composition]
        EntityCollection<FirstChild> FirstChilds { get; set; }
    }
}

[MetadataType(typeof(FirstChildMetaData))]
public partial class FirstChild: 
{
    internal class FirstChildMetaData
    {
        [Include, Composition]
        EntityCollection<SencondChild> SecondChilds { get; set; }
    }
}


You need to also attribute your Collection property with the AssociationAttribute as well as include a ForeignKey on your entity class and reference it in the attributes ctor arguments, remember to include the DataMemberAttribute as well (entity framework already does this by default on generated members)

heres an article outlining it further

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜