Пример #1
0
        public static List <DbObject> ConvertToDbObjectData(IEnumerable <dynamic> data)
        {
            List <DbObject> rows = new List <DbObject>();

            foreach (var row in data)
            {
                var f = row as IDictionary <string, object>;
                rows.Add(DbObject.From(f));
            }
            return(rows);
        }
Пример #2
0
        public static DbObject Single(string query, object param = null, IDbTransaction trans = null)
        {
            DbObject row = new DbObject();

            using (IDbConnection dbConnection = Connection)
            {
                dbConnection.Open();
                var ds = dbConnection.Query <dynamic>(query, param, trans);
                if (ds.Count() > 0)
                {
                    var f = ds.First() as IDictionary <string, object>;
                    row = DbObject.From(f);
                }
                else
                {
                    return(null);
                }
            }

            return(row);
        }