如何将C#项目从"linq转换为sql" "linq到XML" [英] how to convert C# project from "linq to sql" to " linq to XML"

查看:79
本文介绍了如何将C#项目从"linq转换为sql" "linq到XML"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我已经在Windows应用程序中使用linq到sql正常运行,但是由于某些原因,我现在想删除该sql服务器数据库&而不是它,我想使用XML文件作为数据存储.在不进行C#代码更多更改的情况下必须要做的事情.
在我的项目中,我做了这样的事情.
最初,我将n的所有sql数据库表拖放到.net框架中,在这里我得到数据库的q.dbml文件.
&我正在像访问

Hi I have use linq to sql in my windows application it works fine, but now due to some reason I want to remove that sql server database & instead of it I want to use XML files as data storage. what i have to do without doing much more changes in my C# code.
In my project i have done something like this..
initially i drop n drag all my sql database table in .net frame work here i get a q.dbml file of my database.
& i am accessing that like

<code>qDataContext dc = new qDataContext();
 var v = from emp in dc.employees where emp.id == 1 select emp;</code>




是否有任何方法可以用XML替换该sql server数据库,而无需在我的项目编码中进行更多更改.



请帮我.
非常感谢.




IS there any method to replace that sql server database with XML without doing much more changes in my project coding.



please help me.
lot of thanks.

推荐答案

Linq to XML与Linq to SQL不同,因此您将需要更改所有查询.

LINQ to XML [
Linq to XML is, of course, different than Linq to SQL so you will need to change all of the queries.

LINQ to XML[^]


首先尝试阅读有关^ ]
MSDN- [LINQ:.NET语言集成查询] [ http://www.developerfusion.com/article/84298/linqing-to-xml/ [ ^ ]
最后, [ ^ ] CP搜索将为您提供大量文章,以了解有关语言集成查询的信息.
First try to read about Language Integrated Query[^]
This MSDN-[LINQ: .NET Language-Integrated Query][^] might be useful for further reference where you will know how to convert LINQ to SQL: SQL Integration and LINQ to XML: XML Integration
more Reference http://www.developerfusion.com/article/84298/linqing-to-xml/[^]
At last this[^] CP search will give you plenty of article to learn about Language Integrated Query.


这篇关于如何将C#项目从"linq转换为sql" "linq到XML"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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