This question is locked. New answers and comments are not allowed.
OK, what I want to do is really simple, and everyone must have to do it, and I have found one way to do it, but surely it can't be this hard. I have a Silverlight application, with RIA data services, and on the client side I simply want to do some rudimentary data access queries within an event procedure.
Case in point. On an event I want to retrieve a particular known row of an Accounts table, and retrieve the [Name] column. Easy, construct a LINQ query, accessing the dbContext, but as minimum, it seems you have to call the Load Method, which only initiates the load, then you have to construct a separate event handler for when the LoadOperation is completed, then complete your logic in that separate handler. If you do a lot of these, this is a ridiculously complicated way to get some basic data.
I read somewhere that calling the .ToList() method forces the LINQ/RIA to retrieve the data before proceeding. I did see it work once, but it appears not to any more. All attempts to simply execute a LINQ query like this appear to return no data, unless you construct the separate LoadOperation.Completed Event Handler, and put further logic there.
Can someone please show me how to simply retrieve some data via RIA ORM within a single event procedure?
Case in point. On an event I want to retrieve a particular known row of an Accounts table, and retrieve the [Name] column. Easy, construct a LINQ query, accessing the dbContext, but as minimum, it seems you have to call the Load Method, which only initiates the load, then you have to construct a separate event handler for when the LoadOperation is completed, then complete your logic in that separate handler. If you do a lot of these, this is a ridiculously complicated way to get some basic data.
I read somewhere that calling the .ToList() method forces the LINQ/RIA to retrieve the data before proceeding. I did see it work once, but it appears not to any more. All attempts to simply execute a LINQ query like this appear to return no data, unless you construct the separate LoadOperation.Completed Event Handler, and put further logic there.
Can someone please show me how to simply retrieve some data via RIA ORM within a single event procedure?