public static IQueryable <Port> Include(this IQueryable <Port> query, PortInclude include) { if (include.HasFlag(PortInclude.Node)) { query = query.Include(x => x.Node); } if (include.HasFlag(PortInclude.NodeAggregatedData)) { query = query.Include(x => x.Node.AggregatedData); } return(query); }
public async Task <T> ByNodeIdAndPortNumberAsync <T>(int nodeId, int portNumber, PortInclude includes) where T : Port { return(await _ctx.Ports .Include(includes) .OfType <T>() .SingleOrDefaultAsync(p => p.NodeId == nodeId && p.PortNumber == portNumber)); }
public async Task <Port> ByNodeIdAndPortNumberAsync(int nodeId, int portNumber, PortInclude includes) { return(await _ctx.Ports .Include(includes) .SingleOrDefaultAsync(p => p.NodeId == nodeId && p.PortNumber == portNumber)); }
public async Task <Port> ByNodeRfAndPortNumberAsyn(int rfAddress, byte portNumber, PortInclude includes) { return(await _ctx.Ports .Include(includes) .SingleOrDefaultAsync(p => p.Node.RfAddress == rfAddress && p.PortNumber == portNumber)); }