Example #1
0
 public async Task <List <NodeVm> > GetAllNodesInfoAsync()
 {
     using (MessengerDbContext context = contextFactory.Create())
     {
         return(NodeConverter.GetNodesVm(await context.Nodes
                                         .AsNoTracking()
                                         .Include(opt => opt.NodeKeys)
                                         .Include(opt => opt.DomainNodes)
                                         .Include(opt => opt.Ipnodes)
                                         .ToListAsync()
                                         .ConfigureAwait(false)));
     }
 }
Example #2
0
        public async Task <List <NodeVm> > GetNodesAsync(List <long> nodesId)
        {
            var nodesCondition = PredicateBuilder.New <Node>();

            nodesCondition = nodesId.Aggregate(nodesCondition,
                                               (current, value) => current.Or(opt => opt.Id == value).Expand());
            using (MessengerDbContext context = contextFactory.Create())
            {
                var nodes = await context.Nodes
                            .Include(opt => opt.NodeKeys)
                            .Include(opt => opt.DomainNodes)
                            .Where(nodesCondition)
                            .ToListAsync()
                            .ConfigureAwait(false);

                return(NodeConverter.GetNodesVm(nodes));
            }
        }