• 大小: 808KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-11
  • 语言: 数据库
  • 标签: 三层  Wcf  

资源简介

.net 三层+Wcf框架,自适应Oracle,Mysql,SqlServer三种数据库,内含存储过程,完整实例

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Data.OracleClient;
using MySql.Data.MySqlClient; 

namespace DBUtility
{
    public class DbFactory
    {
        public static string cnString = System.Configuration.ConfigurationSettings.AppSettings[“ConnString“];
        public static string dbFlag = System.Configuration.ConfigurationSettings.AppSettings[“DbFlag“];

        public static DbConnection CreateConnection()
        {
            DbConnection cn = null;

            switch (dbFlag)
            {
                case “1“:
                    cn = new SqlConnection(cnString);
                    break;
                case “2“:
                    cn = new OracleConnection(cnString);
                    break;
                case “3“:
                    cn = new MySqlConnection(cnString);
                    break;
            }

            return cn;
        }

        public static DbCommand CreateCommand(DbConnection cn)
        {
            DbCommand cmd = null;
            switch (dbFlag)
            {
                case “1“:
                    cmd = new SqlCommand();
                    cmd.Connection = cn;
                    break;
                case “2“:
                    cmd = new OracleCommand();
                    cmd.Connection = cn;
                    break;
                case “3“:
                    cmd = new MySqlCommand();
                    cmd.Connection = cn;
                    break;
            }

            return cmd;
        }

        public static DbDataAdapter CreateDataAdapter()
        {
            DbDataAdapter dba = null;
            switch (dbFlag)
            {
                case “1“:
                    dba = new SqlDataAdapter();
                    break;
                case “2“:
                    dba = new OracleDataAdapter();
                    break;
                case “3“:
                    dba = new MySqlDataAdapter();
                    break;
            }

            return dba;
        }

        public static DbParameter[] CreateParameter(Dictionary para)
        {
            DbParameter[] dbPara = null;
            int i = 0;

            switch (dbFlag)
            {
                case “1“:
                    dbPara = new SqlParameter[para.Count];
                    foreach (KeyValuePair dic in para)
                    {
                        dbPara[i] = new SqlParameter(“@“ + dic.Key dic.Value);
                        i++;
                    }
                    break;
                case “2“:
                    dbPara = new OracleParameter[para.Count];
                    foreach (KeyValuePair dic in para)
                

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5100  2013-10-17 11:28  简单三层+wcf\Applicationframe\Applicationframe.sln

    ..A..H.    155648  2013-10-21 10:53  简单三层+wcf\Applicationframe\Applicationframe.v11.suo

     文件       9216  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\bin\Debug\DBUtility.dll

     文件      22016  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\bin\Debug\DBUtility.pdb

     文件     294912  2013-05-22 17:21  简单三层+wcf\Applicationframe\DBUtility\bin\Debug\MySql.Data.dll

     文件       5120  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\bin\Debug\ProjectModel.dll

     文件      15872  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\bin\Debug\ProjectModel.pdb

     文件       3575  2013-10-21 10:45  简单三层+wcf\Applicationframe\DBUtility\DbFactory.cs

     文件       5798  2013-10-16 16:40  简单三层+wcf\Applicationframe\DBUtility\DBHelper.cs

     文件       2911  2013-10-16 17:47  简单三层+wcf\Applicationframe\DBUtility\DBUtility.csproj

     文件       1639  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\DBUtility.csproj.FileListAbsolute.txt

     文件      11229  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\DBUtility.csprojResolveAssemblyReference.cache

     文件       9216  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\DBUtility.dll

     文件      22016  2013-10-21 10:46  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\DBUtility.pdb

     文件       6853  2013-10-17 10:11  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件          0  2013-10-08 10:08  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs

     文件          0  2013-10-08 10:08  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs

     文件          0  2013-10-08 10:08  简单三层+wcf\Applicationframe\DBUtility\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs

     文件       1338  2013-10-08 10:08  简单三层+wcf\Applicationframe\DBUtility\Properties\AssemblyInfo.cs

     文件       9216  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\DBUtility.dll

     文件      22016  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\DBUtility.pdb

     文件     294912  2013-05-22 17:21  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\MySql.Data.dll

     文件       5632  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\ProjectAccess.dll

     文件      11776  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\ProjectAccess.pdb

     文件       5120  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\ProjectModel.dll

     文件      15872  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\bin\Debug\ProjectModel.pdb

     文件       6818  2013-10-17 10:12  简单三层+wcf\Applicationframe\ProjectAccess\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       1824  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\obj\Debug\ProjectAccess.csproj.FileListAbsolute.txt

     文件      16227  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\obj\Debug\ProjectAccess.csprojResolveAssemblyReference.cache

     文件       5632  2013-10-21 10:46  简单三层+wcf\Applicationframe\ProjectAccess\obj\Debug\ProjectAccess.dll

............此处省略192个文件信息

评论

共有 条评论