以下を参照してください: RIA サービスの概要- 4.8.1 関連エンティティを返す。
RegionCurrentStates リストを返すサービス関数で、DataLoadOptions を追加し、メタデータの説明で、States の妥当性に Include 属性を追加します。
ドメイン クラスで定義されたクエリ関数に DataLoadOption を追加します。
public IQueryable<RegionCurrentStates> GetRegionCurrentStates()
{
DataLoadOptions loadOpts = new DataLoadOptions();
loadOpts.LoadWith<RegionCurrentStates>(r => r.States);
this.Context.LoadOptions = loadOpts;
return this.Context.RegionCurrentStates;
}
メタデータ:
//This class in generated by RIA wizard when you create
//your DomainService (based on LinqToSqlDomainService) and you check
//[x]Generate metadata class in wizard window
//file: MyService.metadata.cs
[MetadataTypeAttribute(typeof(RegionCurrentStates.RegionCurrentStatesMetadata))]
public partial class RegionCurrentStates
{
internal sealed class RegionCurrentStatesMetadata
{
[Include] //Add (only) this line
public List<State> States{ get; set; }
}
}
幸運を。