.NET、C#、LINQ、SQL 和 OR-Mapping - 我只是不明白:( [英] .NET, C#, LINQ, SQL and OR-Mapping - I just don't get it :(

查看:67
本文介绍了.NET、C#、LINQ、SQL 和 OR-Mapping - 我只是不明白:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我就是不明白,我什至不确定我的方向是否正确......

I just don't get it, and I'm not even sure if I'm looking in the right direction...

问题:

所以有我的 C# 应用程序.我通过 SSH 连接到在线 MySQL 数据库.现在我可以使用 MySQL Connector/.Net 驱动程序 (http://dev.mysql.com/downloads/connector/net/5.2.html) 在它上面运行 query-stuff.一切正常.

So there is my C# Application. I connect to an online MySQL database via SSH. Now I can run query-stuff on it using the MySQL Connector/.Net driver (http://dev.mysql.com/downloads/connector/net/5.2.html). Everything works fine.

现在我想要一些 OR 映射:我想在本地实体上运行查询.

Now I want to some OR-Mapping: I want to run the querys on local entities.

例如:在线数据库中有一个表order",它具有order_total"和order_date"属性.

For example: In the online database, there is the table 'order' and it has the attributes 'order_total' and 'order_date'.

现在我运行SELECT * FROM order"

Now I run a "SELECT * FROM order"

接下来是什么?如何将此结果转换为实体,然后在修改后写回更改?直到现在我能发现的是,这与 LINQ 和(也许)XML 有关系.但我只是不明白整个事情:(

What's next? How can I turn this result into an entity and then write back the changes after I have modified it? All I could find out until now is, that is has to do someting with LINQ and (maybe) XML. But I just don't get the whole thing :(

我感谢每一个提示或一个简短的例子:)

I appreciate every hint or maybe a short example :)

提前致谢!

推荐答案

我认为你在想的是 Linq to Sql.但这仅适用于 SQL Server.

What you are thinking of, i think, is Linq to Sql. But that ONLY works for SQL Server.

http://www.mikeborozdin.com/post/LINQ-To-MySQL.aspx

因此,您唯一的选择是根据从 MySql 服务器获得的数据构建对象,然后对对象执行标准 linq 以进行映射.

So your only option to build objects out of the data that you get from your MySql server, and then do standard linq to objects to do your mapping.

希望这有帮助,干杯,

这篇关于.NET、C#、LINQ、SQL 和 OR-Mapping - 我只是不明白:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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