コード例 #1
0
        public async Task <IReadOnlyCollection <Association> > GetAssociations(IEnumerable <int> ids, string type)
        {
            using (var db = await _data.Connect())
            {
                var idList = string.Join(",", ids);
                if (string.IsNullOrWhiteSpace(idList))
                {
                    return(new Association[0]);
                }

                var sql = $@"select id, type, attributes, created, `from`, `to` from association
                         where type=@t and `from` in ({idList})";

                _logger.LogInformation($"{sql} --- @t = {type}", type);

                return((await db.QueryAsync <Association>(sql, new { t = type })).ToList());
            }
        }