ORM,C#和MySQL-Take2 [英] ORM, C# and MySQL - Take2

查看:102
本文介绍了ORM,C#和MySQL-Take2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题实际上是指已经有人问过的另一个问题,现在我要重新表达一下:)

This questions actually refers to another one already asked, now I want to reformulate it :)

我的问题是:有一个在线商店在MySQL数据库上运行,并托管在Internet上.现在,我想从我的C#应用​​程序中做一些管理工作.

My issue is: There is an online shop running on MySQL database, hosted somewehre on the internet. Now I'd like to do some administration stuff from my C# application.

我想做的是:我想要在该数据库上运行SQL查询,并在应用程序中以实体形式获取结果,以便像常规列表/类一样浏览它们,然后将更改回发到数据库.问题不在于与数据库的连接-它可以正常工作(使用SSH和Connector/NET驱动程序)-而是一个问题,如何将SQL结果转换为C#类.

What I want to do: All I want is to run SQL-queries on that database and get the results as entities in my application so I can browse through them like through normal Lists/Classes and then post back the changes to the database. The problem is not the connection to the database - it works fine (using SSH and Connector/NET driver) - but the question, how to turn the SQL-results into C# classes.

我仔细查看了 Fluent NHibernate SubSonic ,但我仍然无法确定哪一个最适合或什至更糟-如果这些确实是解决我的问题的正确方法.

I had a closer look at Fluent NHibernate and SubSonic, but I still can't figure out which one suits best or - even worse - if these are really the right approaches to my problem.

因此,我不想构建一个将自己的数据存储在数据库中但从公共数据库中获取所需数据的应用程序.

So I don't want to build an application which stores its own data in a database but gets the data it needs from a public database.

我希望这次我能使自己更清楚:)

I hope I could make myself more clear this time :)

提前谢谢!

推荐答案

ORM绝对是成功的方法,因为它允许您抽象数据访问.

ORM is definitely the way to, because it allows you to abstract your data access.

您可能会发现代码生成器很有用(以避免重复编写类及其所有属性的任务): NHibernate代码生成.

You may find a code generator helpful (to avoid the repetitive task of writing the classes and all their properties): NHibernate Code Generation.

通过这种方式,您仍然可以使用经典的NHibernae代替Fluent Hibernate,顺便说一句,它看起来非常有用.

This way you can still use classic NHibernae instead of Fluent Hibernate, which by the way looks pretty useful.

这篇关于ORM,C#和MySQL-Take2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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