Silverlight4、Ria ServicesおよびEntity Frameworkを使用している問題が発生しました。Riaサービスとナビゲーションプロパティの問題
私は、このメソッドが呼び出される私のDomainServiceクラスで、RIAサービスを通じていくつかのデータを取得しようと私のSLクライアントから:私は、リストの内容を確認するとき
public IQueryable<LastMinuteWachtLijstPromotie> GetLastMinuteWachtLijstPromoties(){
IQueryable<LastMinuteWachtLijstPromotie> list = (IQueryable<LastMinuteWachtLijstPromotie>)this.ObjectContext.LastMinuteWachtLijstPromoties.Include("Promotie");
return (from LastMinuteWachtLijstPromotie lwmp in list where lwmp.Actief select lwmp);
}
、デバッグモードでは、それはでいっぱいですタイプLastMinuteWachtLijstPromotieのオブジェクト。 これらのオブジェクトには、Promotieというオブジェクトのナビゲーションプロパティがあります。 そして私はこれらのPromotieオブジェクトのプロパティにアクセスできます。読み込みが完了したときしかしメソッドが呼び出されますsilverightクライアントで
:予想通り、私はすべての要求LastMinuteWachtLijstPromotieオブジェクトを取得し、この方法では
public void OnLoadEntitiesCompleted(ServiceLoadResult<T> result) {
}
は、プロパティ Promotieしかしnullです。
私は
これらの同じ方法
は私のドメインモデルと異なるオブジェクトに使用されている(「Promotie」)Promotieが自動でメタデータクラス 生成されたプロパティの[含める]のタグを設定して、私は.INCLUDEを使用していますこれは完全に機能します。 また、.edmxファイルにデータベースのマッピングとナビゲーションのプロパティとの相違点があります。誰もが同じ問題を抱えているか、解決策を知っていますか?
メタデータクラス:
[MetadataTypeAttribute(typeof(LastMinuteWachtLijstPromotie.LastMinuteWachtLijstPromotieMetadata))]
public partial class LastMinuteWachtLijstPromotie
{
// This class allows you to attach custom attributes to properties
// of the LastMinuteWachtLijstPromotie class.
//
// For example, the following marks the Xyz property as a
// required property and specifies the format for valid values:
// [Required]
// [RegularExpression("[A-Z][A-Za-z0-9]*")]
// [StringLength(32)]
// public string Xyz { get; set; }
internal sealed class LastMinuteWachtLijstPromotieMetadata
{
// Metadata classes are not meant to be instantiated.
private LastMinuteWachtLijstPromotieMetadata()
{
}
public int AlertId { get; set; }
public string ArtikelNummer { get; set; }
public Nullable<int> ArtikelVariant { get; set; }
public int LastMinuteWachtLijstPromotieId { get; set; }
[Include]
public Promotie Promotie { get; set; }
public int PromotieArtikelId { get; set; }
public int PromotieId { get; set; }
public bool Actief { get; set; }
public DateTime Aanmaakdatum { get; set; }
}
}
[MetadataTypeAttribute(typeof(Promotie.PromotieMetadata))]
public partial class Promotie
{
// This class allows you to attach custom attributes to properties
// of the Promotie class.
//
// For example, the following marks the Xyz property as a
// required property and specifies the format for valid values:
// [Required]
// [RegularExpression("[A-Z][A-Za-z0-9]*")]
// [StringLength(32)]
// public string Xyz { get; set; }
internal sealed class PromotieMetadata
{
// Metadata classes are not meant to be instantiated.
private PromotieMetadata()
{
}
public string ActieType { get; set; }
public string AssortimentsManagerNaam { get; set; }
public string AssortimentsManagerTeamIds { get; set; }
[Display(Name = "Commerciele tekst")]
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(Nokavision.ReclameFolder.UI.Web.Resources.ValidationResources))]
public string CommercieleTekst { get; set; }
[Display(Name = " ")]
public string CommercieleTekstDetails { get; set; }
[Include]
public Frame Frame { get; set; }
public Nullable<int> FrameId { get; set; }
public Nullable<DateTime> LastMinuteWijzigingsDatum { get; set; }
public string Opmerkingen { get; set; }
[Display(Name = "Op wachtlijst")]
public Nullable<bool> OpWachtLijst { get; set; }
//public Nullable<int> PromotieCopyId { get; set; }
public int PromotieId { get; set; }
[Include]
public EntityCollection<PromotieLeverancier> PromotieLeveranciers { get; set; }
[Include]
public EntityCollection<PromotieMutatie> PromotieMutaties{ get; set; }
//public Nullable<int> PromotieOrigineleId { get; set; }
[Include]
public EntityCollection<PromotieSymbool> PromotieSymbolen { get; set; }
public string Status { get; set; }
[Display(Name = "Promotie inhoud")]
public string PromotieInhoud { get; set; }
[Display(Name = "Promotie eenheid")]
public string PromotieEenheid { get; set; }
[Display(Name = "Promotie prijs")]
public decimal PromotiePrijs { get; set; }
}
}
あなたが特にLastMinuteWachtLijstPromotieとPromotieのために、メタデータクラスを追加することができますか? – Jehof
元の投稿に追加、tnx – Thomas
外部キーを追加せずにNavigationPropertyを定義しましたか? – Jehof