关于DotNet项目架构

1.以前一直是用自成的DB类库+Commons类库作为通用层
2.最近看了LTP的架构及Microsoft的PetShop.
3.目前决定对自己类库作改进。

其中DB核心代码:
DBOperator.cs(abstract)
None.gif using  System;
None.gif
using  System.Collections.Generic;
None.gif
using  System.Text;
None.gif
using  System.Data;
None.gif
using  System.Data.SqlClient;
None.gif
using  System.Data.OleDb;
None.gif
using  System.Data.OracleClient;
None.gif
None.gif
namespace  XPC.DB
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 抽象数据库操作类。
InBlock.gif    
/// 类编码:QQDB001
InBlock.gif    
/// </summary>
ExpandedSubBlockEnd.gif    
/// <remark>抽象数据库操作类,类编码:QQDB001</remark>

InBlock.gif    public abstract class DBOperator
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法#region 方法
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: Connection()#region 方法: Connection()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 得到数据库连接
InBlock.gif        
/// 函数编码:001
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>返回数据库连接IDbConnection</returns>
ExpandedSubBlockEnd.gif        
/// <remark>得到数据库连接,函数编码:001</remark>

InBlock.gif        public abstract IDbConnection Connection();
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: Open()#region 方法: Open()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 打开数据库连接,函数编码:002
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>是否成功</returns>
ExpandedSubBlockEnd.gif        
/// <remark>打开数据库连接,函数编码:002</remark>

InBlock.gif        public abstract bool Open();
InBlock.gif    
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: Close()#region 方法: Close()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 关闭数据库连接,函数编码:003
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>是否成功</returns>
ExpandedSubBlockEnd.gif        
/// <remark>关闭数据库连接,函数编码:003</remark>

InBlock.gif        public abstract bool Close();
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: BeginTrans()#region 方法: BeginTrans()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 开始一个事务,函数编码:004
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>是否成功</returns>
ExpandedSubBlockEnd.gif        
/// <remark>开始一个事务,函数编码:004</remark>

InBlock.gif        public abstract bool BeginTrans();
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: CommitTrans()#region 方法: CommitTrans()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行事务,函数编码:005
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>是否成功</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行事务,函数编码:005</remark>

InBlock.gif        public abstract bool CommitTrans();
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: RollbackTrans()#region 方法: RollbackTrans()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 回滚一个事务,函数编码:006
InBlock.gif        
/// </summary>        
InBlock.gif        
/// <returns>是否成功</returns>
ExpandedSubBlockEnd.gif        
/// <remark>回滚一个事务,函数编码:006</remark>

InBlock.gif        public abstract bool RollbackTrans();
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: Execute(string strSql,)#region 方法: Execute(string strSql,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句,返回影响行数。函数编码:007
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">Sql语句</param>        
InBlock.gif        
/// <returns>返回int,影响的行数</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句,返回影响行数。函数编码:007</remark>

InBlock.gif        public abstract int Execute(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: Execute(string strSql,out string strCurrentID,)#region 方法: Execute(string strSql,out string strCurrentID,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句,out当前ID。函数编码:008
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>
InBlock.gif        
/// <param name="strCurrentID">输出当前ID</param>        
InBlock.gif        
/// <returns>无返回</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句,out当前ID。函数编码:008</remark>

InBlock.gif        public abstract void Execute(string strSql,out string strCurrentID);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetScalar(string strSql)#region 方法: GetScalar(string strSql)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回第一行第一列的值。函数编码:009
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>string类型每一行第一列</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回第一行第一列的值。函数编码:009</remark>

InBlock.gif        public abstract string GetScalar(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetDataTable(string strSql)#region 方法: GetDataTable(string strSql)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回DataTable。函数编码:010
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>一个记录集datatable</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回DataTable。函数编码:010</remark>

InBlock.gif        public abstract DataTable GetDataTable(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetDataSet(string strSql)#region 方法: GetDataSet(string strSql)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回DataSet。函数编码:011
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>返回数据集DataSet</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回DataSet。函数编码:011</remark>

InBlock.gif        public abstract DataSet GetDataSet(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetSqlDataReader(string strSql)#region 方法: GetSqlDataReader(string strSql)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回SqlDataReader。重要:其中的Connection没有关闭,函数编码:012
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>返回SqlDataReader</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回SqlDataReader。重要:其中的Connection没有关闭。函数编码:012</remark>

InBlock.gif        public abstract SqlDataReader GetSqlDataReader(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetSqlDataReader(string strSql,SqlConnection conn)#region 方法: GetSqlDataReader(string strSql,SqlConnection conn)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回SqlDataReader。重要:其中的Connection没有关闭,函数编码:012
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>
InBlock.gif        
/// <param name="conn">Sql连接</param>
InBlock.gif        
/// <returns>返回SqlDataReader</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回SqlDataReader。重要:其中的Connection没有关闭。函数编码:012</remark>

InBlock.gif        public abstract SqlDataReader GetSqlDataReader(string strSql, out SqlConnection sqlconn);
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetOleDBDataReader(string strSql,)#region 方法: GetOleDBDataReader(string strSql,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回OleDBDataReader。重要:其中的Connection没有关闭,函数编码:013
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>返回OleDBDataReader</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回OleDBDataReader。重要:其中的Connection没有关闭,函数编码:013</remark>

InBlock.gif        public abstract OleDbDataReader GetOleDBDataReader(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetOracleDataReader(string strSql,)#region 方法: GetOracleDataReader(string strSql,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行SQL语句返回OracleDataReader。重要:其中的Connection没有关闭,函数编码:014
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSql">SQL语句字符串</param>        
InBlock.gif        
/// <returns>返回OracleDataReader</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行SQL语句返回OracleDataReader。重要:其中的Connection没有关闭,函数编码:014</remark>

InBlock.gif        public abstract OracleDataReader GetOracleDataReader(string strSql);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: ExecuteProc(string strProcedureName,)#region 方法: ExecuteProc(string strProcedureName,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回影响行数。函数编码:015
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>        
InBlock.gif        
/// <returns>返回int类型的影响行数</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回影响行数函数编码:015</remark>

InBlock.gif        public abstract int ExecuteProc(string strProcedureName);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray,)#region 方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回影响行数。函数编码:016
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>        
InBlock.gif        
/// <returns>返回int类型的影响行数</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回影响行数,函数编码:016</remark>

InBlock.gif        public abstract int ExecuteProc(string strProcedureName,IDataParameter [] arrParameterArray);
InBlock.gif    
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray,out string strOutValue)#region 方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray,out string strOutValue)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回影响行数。其中out一个参数的值,此参数可以为不是input的其它类型
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>
InBlock.gif        
/// <param name="strOutValue">out的参数,把存在过程的参数中类型不是Input的最后一个参数的值返回</param>
InBlock.gif        
/// <returns>返回影响行数</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回影响行数</remark>

InBlock.gif        public abstract int ExecuteProc(string strProcedureName, IDataParameter[] arrParameterArray, out string strOutValue);
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray, out string strCurrentID)#region 方法: ExecuteProc(string strProcedureName,idataparameter [] arrParameterArray, out string strCurrentID)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回影响行数。函数编码:016
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>
InBlock.gif        
/// <param name="strCurrentID">out 当前ID</param>
InBlock.gif        
/// <returns>返回int类型的影响行数</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回影响行数,函数编码:016</remark>

InBlock.gif        public abstract int ExecuteProc(string strProcedureName, IDataParameter[] arrParameterArray, out int strCurrentID);
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
InBlock.gif        
public abstract string GetProcScalar(string strProcedureName);
InBlock.gif
InBlock.gif        
public abstract string GetProcScalar(string strProcedureName, IDataParameter[] arrParameterArray);
InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataTable(string strProcedureName,)#region 方法: GetProcDataTable(string strProcedureName,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataTable。函数编码:017
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>        
InBlock.gif        
/// <returns>返回DataTable</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataTable,函数编码:017</remark>

InBlock.gif        public abstract DataTable GetProcDataTable(string strProcedureName);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataTable(string strProcedureName,int intTableIndex,)#region 方法: GetProcDataTable(string strProcedureName,int intTableIndex,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataTable。函数编码:018
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="intTableIndex">表索引号</param>        
InBlock.gif        
/// <returns>返回DataTable</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataTable,函数编码:018</remark>

InBlock.gif        public abstract DataTable GetProcDataTable(string strProcedureName,int intTableIndex);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataTable(string strProcedureName,idataparameter [] arrParameterArray,)#region 方法: GetProcDataTable(string strProcedureName,idataparameter [] arrParameterArray,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataTable。函数编码:019
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>        
InBlock.gif        
/// <returns>返回DataTable</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataTable,函数编码:019</remark>

InBlock.gif        public abstract DataTable GetProcDataTable(string strProcedureName,IDataParameter [] arrParameterArray);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataTable(string strProcedureName,idataparameter [] arrParameterArray,int intTableIndex,)#region 方法: GetProcDataTable(string strProcedureName,idataparameter [] arrParameterArray,int intTableIndex,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataTable。函数编码:019
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>
InBlock.gif        
/// <param name="intTableIndex">表索引号</param>        
InBlock.gif        
/// <returns>返回DataTable</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataTable,函数编码:019</remark>

InBlock.gif        public abstract DataTable GetProcDataTable(string strProcedureName,IDataParameter [] arrParameterArray,int intTableIndex);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataSet(string strProcedureName,)#region 方法: GetProcDataSet(string strProcedureName,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataSet。c函数编码:020
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>        
InBlock.gif        
/// <returns>返回DataSet</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataSet,函数编码:020</remark>

InBlock.gif        public abstract DataSet GetProcDataSet(string strProcedureName);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
方法: GetProcDataSet(string strProcedureName,idataparameter [] arrParameterArray,)#region 方法: GetProcDataSet(string strProcedureName,idataparameter [] arrParameterArray,)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行存储过程,返回DataSet。,函数编码:021
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strProcedureName">存储过程名</param>
InBlock.gif        
/// <param name="arrParameterArray">参数集合</param>        
InBlock.gif        
/// <returns>返回DataSet</returns>
ExpandedSubBlockEnd.gif        
/// <remark>执行存储过程,返回DataSet,函数编码:021</remark>

InBlock.gif        public abstract DataSet GetProcDataSet(string strProcedureName,IDataParameter [] arrParameterArray);
InBlock.gif        
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
/批量执行SQL语句#region /////批量执行SQL语句
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 批量执行SQL语句
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strSqls">SQL语句数组</param>
ExpandedSubBlockEnd.gif        
/// <returns>true成功,false失败</returns>

InBlock.gif        public abstract bool BatchExecSql(string[] strSqls);
ExpandedSubBlockEnd.gif          
#endregion

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 清理释放
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public abstract void Dispose();
InBlock.gif        
InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

DBOperatorFactory.cs (DBFactory)
None.gif using  System;
None.gif
using  System.Collections.Generic;
None.gif
using  System.Text;
None.gif
None.gif
namespace  XPC.DB
ExpandedBlockStart.gifContractedBlock.gif
dot.gif {
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 调用数据库操作类的工厂类 的摘要说明。
InBlock.gif    
/// 选择那种数据库
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class DBOperatorFactory
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
InBlock.gif        
//读取配置中的数据库类型,连接字符串
InBlock.gif
        private static readonly string C_strDBType = System.Configuration.ConfigurationSettings.AppSettings["DBType"];//Common.GetWebConfigValue("DBType").Trim();
InBlock.gif
        private static readonly string C_strConnection = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];//Common.GetWebConfigValue("ConnectionString").Trim();
InBlock.gif
        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取一个数据库操作对象
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="strConnection">数据库连接字符串</param>
ExpandedSubBlockEnd.gif        
/// <returns>数据库操作对象</returns>

InBlock.gif        public static DBOperator GetDBOperator()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
//string 
InBlock.gif
                switch (DBOperatorFactory.C_strDBType.ToUpper())
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    
case "SQLSERVER":                        
InBlock.gif                        
return new SqlDBOperator(DBOperatorFactory.C_strConnection);                        
InBlock.gif                    
case "ORACLE":
InBlock.gif                        
return null;
InBlock.gif                    
case "OLEDB":
InBlock.gif                        
return null;
InBlock.gif                    
case "ODBC":
InBlock.gif                        
return null;
InBlock.gif                    
default:
InBlock.gif                        
InBlock.gif                        
return new SqlDBOperator(DBOperatorFactory.C_strConnection);
ExpandedSubBlockEnd.gif                }
                
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception ex)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw ex;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif      
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif
DB层,Common层,一些自行开发用户控件源码下载
方案:
1.原有库保留,Pet的接口模式目前不适合,添加BLL.Util,此为基于DB层,为BLL所调用

转载于:https://www.cnblogs.com/mazei/archive/2006/07/03/441110.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值