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)); }
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)); }
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)); }
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)); }
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)); } }
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)); }