コード例 #1
0
        public AncestorResult Query <T>(IModel objectModel) where T : class, IModel, new()
        {
            var isSuccess    = false;
            var sqlString    = string.Empty;
            var returnResult = new AncestorResult();
            var parameters   = new List <OracleParameter>();
            var dataTable    = new DataTable();

            try
            {
                SqlString.Clear();
                // 2015-08-31
                //sqlString = QueryStringGenerator(objectModel, parameters);
                var tableName = objectModel.GetType().Name;
                SqlString.Append("SELECT " + tableName + ".*, ROWID FROM " + tableName);
                var sqlWhereCondition = ParseWhereCondition(objectModel, parameters);
                SqlString.Append(sqlWhereCondition);

                isSuccess             = DB.Query(SqlString.ToString(), parameters, ref dataTable);
                returnResult.Message  = DB.ErrorMessage;
                returnResult.DataList = dataTable.ToList <T>();
            }
            catch (Exception exception)
            {
                returnResult.Message = exception.ToString();
                isSuccess            = false;
            }
            returnResult.IsSuccess = isSuccess;

            return(returnResult);
        }
コード例 #2
0
        public void Clear_Test()
        {
            var query = new SqlString("Hello");

            query.Clear();
            Assert.AreEqual(String.Empty, query);
        }