Beispiel #1
0
        public BaseDataProvider(EnumDataProviderType?emProvider)
        {
            if (emProvider == null)
            {
                throw new CustomException("数据库枚举未赋值");
            }

            _emProvider = emProvider.Value;
        }
Beispiel #2
0
        /// <summary>
        /// Constructs a data access layer data provider.
        /// </summary>
        public static DataProviderBaseClass GetDataProvider(EnumDataProviderType dataProviderType, string connectionString)
        {
            // construct specific data access provider class
            switch (dataProviderType)
            {
            case EnumDataProviderType.Access:
            case EnumDataProviderType.OleDb:
                return(new OleDbDataAccessLayer(connectionString));

            case EnumDataProviderType.Odbc:
                return(new OdbcDataAccessLayer(connectionString));

            case EnumDataProviderType.Oracle:
                return(new OracleDataAccessLayer(connectionString));

            case EnumDataProviderType.SqlClient:
                return(new SqlDataAccessLayer(connectionString));

            default:
                throw new ArgumentException("Invalid data access layer provider type.");
            }
        }
Beispiel #3
0
 public TestDbProvider(EnumDataProviderType emProvider = EnumDataProviderType.TestDb) : base(emProvider)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Constructs a data access layer based on caller specific data provider.
 /// Caller of this method must provide the database connection string through ConnectionString property.
 /// </summary>
 public static DataProviderBaseClass GetDataProvider(EnumDataProviderType dataProviderType)
 {
     return(GetDataProvider(dataProviderType, null));
 }
Beispiel #5
0
 /// <summary>
 /// Constructs a data access layer based on caller specific data provider.
 /// Caller of this method must provide the database connection string through ConnectionString property.
 /// </summary>
 public static DataProviderBaseClass GetDataProvider(EnumDataProviderType dataProviderType)
 {
     return GetDataProvider(dataProviderType, null);
 }
Beispiel #6
0
        /// <summary>
        /// Constructs a data access layer data provider.
        /// </summary>
        public static DataProviderBaseClass GetDataProvider(EnumDataProviderType dataProviderType, string connectionString)
        {
            // construct specific data access provider class
            switch (dataProviderType)
            {
                case EnumDataProviderType.Access:
                case EnumDataProviderType.OleDb:
                    return new OleDbDataAccessLayer(connectionString);

                case EnumDataProviderType.Odbc:
                    return new OdbcDataAccessLayer(connectionString);

                case EnumDataProviderType.Oracle:
                    return new OracleDataAccessLayer(connectionString);

                case EnumDataProviderType.SqlClient:
                    return new SqlDataAccessLayer(connectionString);

                default:
                    throw new ArgumentException("Invalid data access layer provider type.");
            }
        }
 public PmhMallDataProvider(EnumDataProviderType emProvider = EnumDataProviderType.PmhMall) : base(emProvider)
 {
 }
Beispiel #8
0
 public PmhMobileDataProvider(EnumDataProviderType emProvider = EnumDataProviderType.PmhMobile) : base(emProvider)
 {
 }