public List <Person> GetAll(InputPerson input) { using (var scope = _scopeFactory.CreateScope()) using (var db = scope.ServiceProvider.GetRequiredService <GraphQLContext>()) { return(db.Person.Where(input?.Predicate ?? (_ => true)).ToList()); } }
public Person Get(InputPerson input) { using (var scope = _scopeFactory.CreateScope()) using (var db = scope.ServiceProvider.GetRequiredService <GraphQLContext>()) { return(db.Person.FirstOrDefault(input?.Predicate ?? (_ => false))); } }
public List <Person> GetFriends(int personId, InputPerson input) { using (var scope = _scopeFactory.CreateScope()) using (var db = scope.ServiceProvider.GetRequiredService <GraphQLContext>()) { return(db.Person .Include(x => x.Friends) .FirstOrDefault(s => s.Id == personId) ?.Friends .Where(input?.Predicate ?? (_ => true)) .ToList() ); } }
public List <Person> Friends(Person person, InputPerson input) => _persons.GetFriends(person.Id, input);
public List <Person> Persons(InputPerson input) => _persons.GetAll(input);
public Person Person(InputPerson input) => _persons.Get(input);
public List <Person> Friends(Engineer engineer, InputPerson input) => _persons.GetFriends(engineer.Id, input);
public List <Person> Friends(Contact contact, InputPerson input) => _persons.GetFriends(contact.Id, input);
public List <Person> Friends(Candidate candidate, InputPerson input) => _persons.GetFriends(candidate.Id, input);