views:

40

answers:

1

I'm using WCF RIA Services and I have a domain service method that returns a single entity. In my Silverlight client project I'm now using following code to retrieve that entity:

ctxt.Load(ctxt.GetEmployeeByNumberQuery("ABC123")).Completed += new System.EventHandler(EmployeeLoad_Completed);


    void EmployeeLoad_Completed(object sender, System.EventArgs e)
    {
        Employee myEmployee = (sender as LoadOperation<Employee>).Entities.FirstOrDefault();
    }

Is there any better or more elegant method?

A: 

Nope. That's the minimum amount you'd have to write to get a single entity.

Kyle McClellan
Thanks Kyle. I couldn't find much documentation on single entities in RIA and was wondering about this.
Coolwayfarer