ORM, C# and MySQL - Take2

回眸只為那壹抹淺笑 提交于 2020-02-06 04:23:03

问题


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

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.

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.

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 :)

Thanks in advance!


回答1:


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

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

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



来源:https://stackoverflow.com/questions/4469274/orm-c-sharp-and-mysql-take2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!