This is a migrated thread and some comments may be shown as answers.

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

1 Answer 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 06 Dec 2014, 05:42 AM
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?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 09 Dec 2014, 08:11 AM
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.

 
Tags
GridView
Asked by
Mike
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or