示例#1
0
        public IDynamicTableObject get(object id)
        {
            EnsureTableCreated();
            var data = Database.SqlExecuter.QueryData(Name, $"{_schema.PrimaryKey} == '{id}'").FirstOrDefault();

            return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .Create(data as IDictionary <string, object>, this));
        }
示例#2
0
        public IDynamicTableObject[] findAll(string field, object value)
        {
            EnsureTableCreated();
            var data = Database.SqlExecuter.QueryData(Name, $"{field} == '{value}'");

            return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .CreateList(data.Select(s => s as IDictionary <string, object>).ToArray(), this));
        }
示例#3
0
        public IDynamicTableObject find(string fieldName, object matchValue)
        {
            EnsureTableCreated();
            var data = Database.SqlExecuter.QueryData(Name, $"{fieldName} == '{matchValue}'").FirstOrDefault();

            return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .Create(data as IDictionary <string, object>, this));
        }
示例#4
0
        public IDynamicTableObject[] all()
        {
            EnsureTableCreated();
            var data = Database.SqlExecuter.QueryData(Name);

            return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .CreateList(data.Select(s => s as IDictionary <string, object>).ToArray(), this));
        }
示例#5
0
 public IDynamicTableObject[] Query(string sql, object param = null)
 {
     using (var connection = SqlExecuter.CreateConnection())
     {
         var data = connection.Query <object>(sql, param).ToArray();
         return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .CreateList(data.Select(s => s as IDictionary <string, object>).ToArray(), null));
     }
 }
示例#6
0
        public IDynamicTableObject[] take(int count)
        {
            var desc    = Ascending ? string.Empty : "DESC";
            var orderBy = OrderByField == null ? null : $"{OrderByField} {desc}";
            var data    = _table.Database.SqlExecuter.QueryData(_table.Name, SearchCondition, count, skipcount, orderBy);

            return(RelationalDynamicTableObject <TExecuter, TSchema, TConnection> .CreateList(data.Select(s => s as IDictionary <string, object>).ToArray(), _table));
        }