如何通过WCF数据服务公开存储过程并在WPF客户端应用程序中使用它? [英] How to expose a stored procedure via WCF data services and consume it in WPF client application?

查看:110
本文介绍了如何通过WCF数据服务公开存储过程并在WPF客户端应用程序中使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的存储过程,它返回一个int32(从客户中选择max(ID)) - 如何通过EF4 + WCF数据服务公开它并从WPF客户端使用它?

I have a simple stored proc which returns an int32 (select max(ID) from customer) - how can I expose that via EF4+WCF data services and use it from a WPF client?

有很多关于将SP作为函数映射到EF4的信息,但是在WCF数据服务中公开它并在客户端中使用的下一步似乎是难以捉摸的。 '如何......'非常感谢。

There is lot of info about mapping a SP as a function in EF4 but the next step of exposing it in WCF dataservice and using in a client seems to be elusive. A 'How to...." for this will be very greatly appreciated.

 

谢谢

 

 

推荐答案

b
$
您可以在WCF数据服务中创建一个服务操作,该服务将公开FunctionImport。以下是我写的两篇关于服务操作以及如何使用它们的帖子:

http://blogs.microsoft.co.il/blogs/gilf/archive/2008/11/14/service-operations -adding-business-logic-to-a-data-service.aspx

http://blogs.microsoft.co.il/blogs/gilf/archive/2008/11/14/consuming-data-services- service-operations.aspx

这篇文章解释了如何在LINQ to SQL模型之上创建服务操作:

http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/16/ado-net-data-services-part-2-using-service-operations-with-webget.aspx
 

imp lementation也可以调整到EF。

Here is a post that explain how to create a service operation on top of a LINQ to SQL model: http://blogs.microsoft.co.il/blogs/bursteg/archive/2007/12/16/ado-net-data-services-part-2-using-service-operations-with-webget.aspx 
The implementation can be adjust also to EF.

我希望它能帮到你。


这篇关于如何通过WCF数据服务公开存储过程并在WPF客户端应用程序中使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆