开发者

How to retrieve single record in WCF RIA Services?

开发者 https://www.devze.com 2023-01-08 21:00 出处:网络
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:

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(EmployeeLo开发者_JAVA百科ad_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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消