Beispiel #1
0
        internal static ILightDataTable Select(ICustomRepository repository, Type type, QueryItem quary = null)
        {
            var sql = new StringBuilder();

            sql.Append(Querys.Select(type, repository.GetDataBaseType() == DataBaseTypes.Sqllight).Execute());
            if (quary != null && quary.HasValue())
            {
                sql.Append(quary.Execute());
            }

            return(repository.GetLightDataTable(repository.GetSqlCommand(sql.ToString())));
        }
Beispiel #2
0
        /// <summary>
        /// Get all by object
        /// PrimaryKey attr must be set ins Where
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="repository"></param>
        /// <param name="quary"></param>
        /// <returns></returns>

        internal static List <T> Select <T>(ICustomRepository repository, QueryItem quary = null) where T : class
        {
            var type = typeof(T);
            var sql  = new StringBuilder();

            sql.Append(Querys.Select(type, repository.GetDataBaseType() == DataBaseTypes.Sqllight).Execute());
            if (quary != null && quary.HasValue())
            {
                sql.Append(quary.Execute());
            }

            return(repository.GetLightDataTable(repository.GetSqlCommand(sql.ToString())).Rows.ToObject <T>());
        }