Fluent Mapping with FetchPlans is escaping me (Can't load data into radGridView)

2 posts, 0 answers
  1. Mike
    Mike avatar
    28 posts
    Member since:
    Apr 2013

    Posted 05 Dec 2014 Link to this post

    I'm having a fair bit of trouble trying to get a binding to work between a Data Access Fluent mapped class using the FetchPlans approach.

    I had a previously working RadDataGrid working based on an ObservableCollection, which I manually populated, as you would expect. Now I'm converting the app over to Data Access and I'm stumbling. I have the following code that creates the Fetch Strategy and if I look at the log it does generate the output I would expect from the foreach loops.

    Telerik.OpenAccess.FetchOptimization.FetchStrategy fetchStrategy = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
    fetchStrategy.LoadWith<SessionData>(ses => ses.sesAPISource);
    fetchStrategy.LoadWith<LapData>(lap => lap.mapSessionIdLap);
    fetchStrategy.LoadWith<TelemetryData>(tel => tel.mapLapIdTelemetry);
     
    simData.sessionQueryable = from c in simData.fluentModelContext.fluentSessions
            where c.sesAPISource == "MEMAPI"
            select c;
     
    //test the iteration through the dataset
    foreach (SessionData thesessions in simData.sessionQueryable)
    {
        logger.Trace("Session: " + thesessions.sesTime);
        foreach (LapData thelaps in thesessions.sesLapData)
        {
            logger.Trace("Lap: " + thelaps.ltLapNumber);
            int i = 0;
            foreach (TelemetryData thetel in thelaps.ltTelemetryData)
            {
                i++;
                logger.Trace("Tel: " + thetel.telCurrentTime);
                if (i > 20)
                    break; //there is a lot of them
                }
            }
    }

    Previously I had a datasource binding set to {Binding simData.sessionsList} and an itemssource to {Binding}, which worked fine. When I tried accessing the data directly with this: "simData.fluentModelContext.fluentSessions.ToList();" and bound the datasource to {Binding simData.fluentModelContext} and the itemssource to {Binding fluentSessions} that also worked, although the associations didn't, as you may expect.

    But I can't seem to get the bindings correct to work with the queryable, which I have declared like this:

    private IQueryable<SessionData> sessionqueryable;
    public IQueryable<SessionData> sessionQueryable
    {
        get { return sessionqueryable; }
        set { if (sessionqueryable == value) return; SetProperty(ref sessionqueryable, value); }
    }

    I'm fairly sure I've tried all kinds of datasource and itemssource binding combinations, but I just cannot figure out where I've gone wrong. I've tried for about 4 hours or so now and I've just stumped.

    Does anyone have any idea of where I've strayed off the path?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 09 Dec 2014 Link to this post

    Hello,

    I can suggest you checking the FetchStrategy Class documentation. In case you have further questions, please post them in the respective Data Access forum.

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top