如何从LINQ转换为SQL到"LINQ转换为WCF"? [英] How to move from LINQ to SQL to "LINQ to WCF"?

查看:56
本文介绍了如何从LINQ转换为SQL到"LINQ转换为WCF"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在整理一个WPF应用程序,该应用程序最终将使用WCF Web服务作为其数据源.

I'm putting together a WPF application which will eventually use WCF web services as its data source.

在原型开发阶段,我正在SQL 2008数据库上使用LINQ to SQL,并且已经体会到可以轻松进行将新项| LINQ添加到SQL类"并为表生成模型类的过程. ,然后使用LINQ与它对话,并将其传递到我的XAML UI,非常好.

During the prototyping phase, I'm using LINQ to SQL on an SQL 2008 database and have come to appreciate the ease with which I can do "Add New Item | LINQ to SQL Classes" and generate a model class for a table, then speak to it with LINQ and pass this to my XAML UI, very nice.

但是,当我们将数据源从SQL Server切换到WCF Web服务时会发生什么?为了继续使用LINQ,我是否必须:

But what happens when we switch the datasource from SQL Server to WCF web services? In order to continue using LINQ, am I going to have to:

  • 手动编写我自己的LINQ到Web服务类(使用IQueryable等?)
  • 是否有一个代码生成工具可以执行此操作,就像"LINQ-to-WCF"(奇怪的是,这个术语甚至不在Google中出现)
  • 还是我必须从我的Web服务中低效率地获取大量记录,从中创建对象,然后到LINQ-to-objects查询它们?

感谢您在此提供的指导.

Thanks for any direction you can give here.

  • MSDN教程说,添加新项| ADO.NET实体数据服务"
  • 我有VS2008,可以执行添加新项| ADO.NET实体数据模型"
  • MSDN视频说,要使用我在VS2008中没有的 ADO.NET数据服务模板
  • 所有这些最常用的区别是什么?
  • 以及到目前为止我所读到的与"LINQ to Entities"有关的任何内容都需要成本,而"LINQ to SQL"是免费的,因此上面的"Entity Data Service/Model"选项也与LINQ有关.实体?
  • this MSDN tutorial says to "Add New Item | ADO.NET Entity Data Service"
  • I have VS2008 and can just do "Add New Item | ADO.NET Entity Data Model"
  • this MSDN video says to create a new project with the ADO.NET Data Service template which I don't have in VS2008
  • what are the differences between all of these, which are used most commonly?
  • and from what I have read so far anything that has to do with "LINQ to Entities" entail costs whereas "LINQ to SQL" is free, so do the "Entity Data Service/Model" options above have to do with LINQ to Entities?

推荐答案

您可能需要 IUpdatable 接口实现到您的实体,您可以使用 LINQ to SQL ,实体框架, SubSonic 或其他一些.我们正在使用 CodeSmith PLINQO模板,您可以在其中添加此功能到LINQ到SQL.

You'll probably want ADO.NET Data Services. You'll have to add an IUpdatable interface implementation to your entities, and you can use LINQ to SQL, Entity Framework, SubSonic, or a number of others. We're using the CodeSmith PLINQO templates, which allow you to add this functionality to LINQ to SQL.

这篇关于如何从LINQ转换为SQL到"LINQ转换为WCF"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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