Example #1
0
        public static ISQLCacheHelper SQLCacheHelperFactory(SQLTypeEnum sqlType, string conStr)
        {
            if (sqlType == SQLTypeEnum.UnKnow)
            {
                string connectionString =
                    ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString;

                sqlType = (SQLTypeEnum)Enum.Parse(typeof(SQLTypeEnum),
                                                  connectionString.Split(':')[0]);
                conStr = connectionString.Split(':')[1];
            }

            switch (sqlType)
            {
            case SQLTypeEnum.SQLServer:
                return(SQLServer.SQLServerHelper.GetCacheInstace(conStr));

            case SQLTypeEnum.MySQL:
                return(MySQL.MySQLHelper.GetCacheInstace(conStr));

            case SQLTypeEnum.SQLite:
                return(SQLite.SQLiteHelper.GetCacheInstace(conStr));

            case SQLTypeEnum.Access:
                return(Access.AccessHelper.GetCacheInstace(conStr));

            case SQLTypeEnum.Oracle:
                return(Oracle.OracleHelper.GetCacheInstace(conStr));

            default: return(null);
            }
        }
        public void ToEnumTest_Fail(string input)
        {
            SQLTypeEnum result = input.ToEnum <SQLTypeEnum>();

            Assert.NotEqual(SQLTypeEnum.Project, result);
        }
        public void ToEnumTest_Workshift_Pass(string input)
        {
            SQLTypeEnum result = input.ToEnum <SQLTypeEnum>();

            Assert.Equal(SQLTypeEnum.Workshift, result);
        }
        public void ToEnumTest_Client_Pass(string input)
        {
            SQLTypeEnum result = input.ToEnum <SQLTypeEnum>();

            Assert.Equal(SQLTypeEnum.Client, result);
        }