Som obscurity with related entities load


my model:

 

i try entity "entitytype" with referenced collections(entitymetadata, entitypartclrtype).

in this way:

            var objectcontext = new metadataentities();

            var entitytype = objectcontext.entitytype.include("entitymetadata")
                .include("entitypartclrtype")
                .first(et => et.tag == "buildingorganizationstype");

 

all work correctly. entity and inside collections loaded.

when realize in rias

server side service:

    [enableclientaccess]
    public class entitymetadataservice : linqtoentitiesdomainservice<metadataentities>
    { 

        public iqueryable<entitytype> getentitytypebytag(string entitytypetag)
        {
            return context.entitytype.include("entitymetadata")
                .include("entitypartclrtype")
                .where(et => et.tag == entitytypetag);
        }

client side code:

        public static entitytype loadentitymetadata(string entitytag, entitytypeloaded callbacktarget)
        {
            var context = new entitymetadatacontext();
            context.load(context.getentitytypebytagquery(entitytag), mergeoption.overwritecurrentvalues,
               onentitytypeloaded, callbacktarget);

            return null;
        }

        private static void onentitytypeloaded(loadoperation<entitytype> loadoperation)
        {
            if (loadoperation.userstate != null &&
                typeof (entitytypeloaded).isassignablefrom(loadoperation.userstate.gettype()))
            {

                ((entitytypeloaded) loadoperation.userstate).invoke(
                    loadoperation.entities.firstordefault(),loadoperation.error);

            }
        }

i have loaded root entity "entitytype", referenced collections empty

what wrong?

 


 

 

 

have added [include] attribute in metadata?



Silverlight  >  WCF RIA Services with Silverlight



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........