views:

148

answers:

1

This should be REALLY simple but I can't figure it out.

I can bind the data to a datagrid like this below...

var context = new DishViewDomainContext();

this.dataGrid1.ItemsSource = context.Restaurants;

context.Load(context.GetRestaurantsQuery());

. That works... But now I just want that collection in a variable that I can loop through collection... This does not seem possible.. I do this and there seems to be nothing there... Im not really sure what the 3rd line does.. Its running the domain service method but where is it filling the data at?

        var dc = new DomainService1();
        IEnumerable<ApplicationLog> collApplicationLog = dc.ApplicationLogs;
        dc.Load(dc.GetApplicationLogsQuery());

        foreach (ApplicationLog al in collApplicationLog)
        {
            int? i = al.ApplicationID;
        }
A: 

Try the following

var collApplicationLog  = dc.ApplicationLogs.ToList();
Waleed A.K.
ApplicationLogs is type EntitySet<ApplicationLog>so there is no ToList();
punkouter