Esempio n. 1
0
File: Db.cs Progetto: IGionny/Molto
        public T Single <T>(string sql = null, params object[] args)
        {
            sql = _sqlQueryBuilder.SelectSql <T>(sql);
            var selectSql = _sqlQueryBuilder.SingleSql(sql);

            using (var cmd = CreateCommand(selectSql, args))
            {
                using (var r = GetReader(cmd))
                {
                    if (!r.Read())
                    {
                        return(default(T));
                    }
                    return(_dataReaderToPoco.Convert <T>(r));
                }
            }
        }