Beispiel #1
0
        /// <summary>
        /// 生成数据库接口,默认的是 MS-SQL
        /// </summary>
        /// <param name="ConnectionString"></param>
        /// <returns></returns>
        public static IDataAccess CreateDataAccess(string ConnectionString)
        {
            var dp = new DatabaseProperty();
            dp.DatabaseType = DatabaseType.MSSQLServer;
            dp.ConnectionString = ConnectionString;

            return CreateDataAccess(dp);
        }
Beispiel #2
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="pp">数据库属性</param>
        /// <returns></returns>
        private static IDataAccess CreateDataAccess(DatabaseProperty pp)
        {
            switch (pp.DatabaseType)
            {
                case DatabaseType.MSSQLServer:
                    return new MSSqlDataAccess(pp.ConnectionString);

                case DatabaseType.Oracle:
                    return new OracleDataAccess(pp.ConnectionString);

                case DatabaseType.OleDBSupported:
                    return new OleDbDataAccess(pp.ConnectionString);
            }
            return new MSSqlDataAccess(pp.ConnectionString);
        }