public async Task <int> GetCountAsync(string keywords = null, int existnull = 0) { string commonSql = @";with FieldDescNullObj as ( select distinct e.id from sysobjects e inner join syscolumns c on e.id=c.id and e.xtype='U' left join sys.extended_properties d on c.id=d.major_id and c.colid=d.minor_id left join sys.extended_properties f on f.minor_id=0 and f.major_id=c.id where d.value is null or f.value is null )"; return(await _dapperDbContext.QueryFirstOrDefaultAsync <int>(string.Format(@"{0} select count(1) from sysobjects a {1} where a.xtype = 'U' and(@keywords is null or a.name like '' + @keywords + '%')", commonSql, existnull == 1 ? "inner join FieldDescNullObj c on c.id=a.id" : ""), new { keywords = keywords })); }