添加ADO.NET实体模型 [英] Adding an ADO.NET Entity Model

查看:50
本文介绍了添加ADO.NET实体模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



原谅我听起来像个新手,但我想知道当前使用SQL数据库的最佳方法是什么.最近,我不得不设计一个程序,在其中使用SQL数据库,并且访问数据的方式是为每个表创建2个单独的类,然后使用这些类来调用我编写的用于读取和写入的存储过程.数据往返数据库.

就在前几天,我看到一个人可以简单地添加一个ADO.NET实体模型并将其与您的SQL数据库关联.这将为您的每个表以及诸如"AddToTable"之类的方法创建对象.这导致比我以前的尝试少得多的代码.我知道了解后台工作原理是很好的,例如,这些对象和方法是如何实际创建的,等等,但是一旦了解了所有这些,那么让.NET为您完成大部分工作是一种好方法吗? class ="h2_lin">解决方案

处理数据访问的最佳方法是对项目有效的方法.对一个人有效的方法对另一个项目可能不是最好的.

实体框架是一个很好的选择,nHibernate也是如此.


Hi

Forgive me for sounding like a newbie, but I would like to know what the current best way is to work with a SQL database. I recently had to design a program in which I worked with a SQL database, and the way I accessed data was to create 2 seperate classses for each Table, and then I used these classes to call the stored procedures that I wrote to read and write data to and from the database.

Just the other day I saw that one can simply add an ADO.NET Entity Model and associate it with your SQL database. This creates objects for each of your tables as well as methods such as "AddToTable". This results in far less code than my previous attempt. I know its good to know how the background stuff works e.g how these objects and methods are actually created etc., but once one knows all that, is it a good approach to simply let .NET do most of the work for you?

解决方案

The best way to handle data access is what works for the project. What works for one may not be the best for another project.

Entity Framework is a good, and so is nHibernate.


这篇关于添加ADO.NET实体模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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