简体   繁体   English

Silverlight WCF RIA包括

[英]Silverlight WCF RIA Include

In my Silverlight Applcication using RIA Services I have to use [Include] in the metadata file and ObjectContext.Include("WhatEver") in the DomainServiceClass file. 在使用RIA Services的Silverlight应用程序中,我必须在元数据文件中使用[Include] ,在ObjectContext.Include("WhatEver")文件中使用ObjectContext.Include("WhatEver")

Can someone please explain to me why either one of them by itself is not enough? 有人可以向我解释为什么一个人不够用吗?

Thanks in advance! 提前致谢!

Apparently the Association Attribute is missing. 显然,缺少关联属性。 With [Include] use [Association] (in the two related Entities, with the same name for the first parameter). 对于[Include],请使用[Association](在两个相关的Entities中,第一个参数的名称相同)。

here an example 这是一个例子

class Toto
{


public int? Id
{
get;
set;
}

[Include]
[Association("Titi_Toto", "Id", "TotoId")]
public IList<Titi> TitiList
{
get;
set;
}

}

....

class Titi
{


public int? Id
{
get;
set;
}

public int? TotoId
{
get;
set;
}

[Include]
[Association("Titi_Toto", "TotoId", "Id", IsForeighKey=True)]
public Toto TotoRef
{
get;
set;
}

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM