c# - Ria Services and navigation property issues -
i'm encountering issue using silverlight4, ria services , entity framework.
from sl client try data through ria services, in domainservice class method gets called:
public iqueryable<lastminutewachtlijstpromotie> getlastminutewachtlijstpromoties(){ iqueryable<lastminutewachtlijstpromotie> list = (iqueryable<lastminutewachtlijstpromotie>)this.objectcontext.lastminutewachtlijstpromoties.include("promotie"); return (from lastminutewachtlijstpromotie lwmp in list lwmp.actief select lwmp); }
when check contents of list, in debug mode, it's filled objects of type lastminutewachtlijstpromotie. these objects have navigation property object named promotie. , can access properties of these promotie objects.
on silveright client method gets invoked when loading complete:
public void onloadentitiescompleted(serviceloadresult<t> result) { }
in method requested lastminutewachtlijstpromotie objects expected, property promotie null.
i have set [include] tag on property promotie in auto generated metadata class , use .include("promotie")
these same methods used different objects domain model, works perfectly. also, cannot seem find differences in .edmx file database mappings , navigation properties.
has encountered same issue or know solution it?
the metadata classes:
[metadatatypeattribute(typeof(lastminutewachtlijstpromotie.lastminutewachtlijstpromotiemetadata))] public partial class lastminutewachtlijstpromotie { // class allows attach custom attributes properties // of lastminutewachtlijstpromotie class. // // example, following marks xyz property // required property , specifies format valid values: // [required] // [regularexpression("[a-z][a-za-z0-9]*")] // [stringlength(32)] // public string xyz { get; set; } internal sealed class lastminutewachtlijstpromotiemetadata { // metadata classes not meant 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 { // class allows attach custom attributes properties // of promotie class. // // example, following marks xyz property // required property , specifies format valid values: // [required] // [regularexpression("[a-z][a-za-z0-9]*")] // [stringlength(32)] // public string xyz { get; set; } internal sealed class promotiemetadata { // metadata classes not meant 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; } } }
add composition attribute property promotie property of lastminutewachtlijstpromotiemetadata class. should work.
public partial class lastminutewachtlijstpromotie { internal sealed class lastminutewachtlijstpromotiemetadata{ [include] [composition] public promotie promotie { get; set; } } }
Comments
Post a Comment