我如何做一个通用数据访问类? [英] How do I make a Generic Data Access Class?

查看:110
本文介绍了我如何做一个通用数据访问类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ASP.net C#3.5框架,在Visual Studio 2008的工作目前。

ASP.net C# 3.5 Framework, working in Visual Studio 2008 currently.

我要的是一个通用数据访问类。我见过几个人,但我希望看到一个我通过连接字符串和SQL语句,它将返回对象列表或当只有一个项目的对象或无响应时需要一个布尔值,让我知道如果它成功了吗?

What I want is a Generic Data Access Class. I have seen several of them but what I want is to see one that I pass the Connection String and the SQL statement and it will return a List of Objects or when only one item an Object or when no response needed a boolean to let me know if it succeeded?

我希望这是有道理的,如果不让我知道,我会更多地解释。

I hope this makes sense if not let me know and I will explain more.

推荐答案

看看我这个问题的答案:

Check out my answer to this question:

<一个href=\"http://stackoverflow.com/questions/2862428/fastest-method-for-sql-server-inserts-updates-selects\">http://stackoverflow.com/questions/2862428/fastest-method-for-sql-server-inserts-updates-selects

这不是一个完整的类,但它勾画出了基础,一个很好的通用实现,将与LINQ到对象。

It's not a complete class, but it lays out the groundwork for a nice generic implementation that will work with linq-to-objects.

这篇关于我如何做一个通用数据访问类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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