Пример #1
0
 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());
         }
 }
Пример #2
0
 public Person Get(InputPerson input)
 {
     using (var scope = _scopeFactory.CreateScope())
         using (var db = scope.ServiceProvider.GetRequiredService <GraphQLContext>())
         {
             return(db.Person.FirstOrDefault(input?.Predicate ?? (_ => false)));
         }
 }
Пример #3
0
 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()
                    );
         }
 }
Пример #4
0
 public List <Person> Friends(Person person, InputPerson input) => _persons.GetFriends(person.Id, input);
Пример #5
0
 public List <Person> Persons(InputPerson input) => _persons.GetAll(input);
Пример #6
0
 public Person Person(InputPerson input) => _persons.Get(input);
Пример #7
0
 public List <Person> Friends(Engineer engineer, InputPerson input) => _persons.GetFriends(engineer.Id, input);
Пример #8
0
 public List <Person> Friends(Contact contact, InputPerson input) => _persons.GetFriends(contact.Id, input);
Пример #9
0
 public List <Person> Friends(Candidate candidate, InputPerson input) => _persons.GetFriends(candidate.Id, input);