Beispiel #1
0
        public Task <Schema> GetSchemaAsync(Query query)
        {
            CheckServiceActive();
            var handler = QueryResolver.Resolve(query);

            return(handler.GetSchemaAsync(new ErlCRUDQueryExecutionContext(this), query));
        }
Beispiel #2
0
 public PersonType()
 {
     Field(x => x.PersonID).Description("Person Identifier");
     Field(x => x.Name).Description("Person Name");
     Field(x => x.Age).Description("Person Age");
     Field(x => x.Address, nullable: true).Description("Address");
     Field <ListGraphType <HobbyType> >("Hobbies", resolve: context => QueryResolver.GetHobbiesForPerson(context.Source.PersonID), description: "List of hobbies");
 }
Beispiel #3
0
        public virtual Cursor OpenCursor(Query query)
        {
            var db = GetDatabase();

            var handler = QueryResolver.Resolve(query);
            var context = new MongoDBCRUDQueryExecutionContext(this, db);
            var result  = handler.OpenCursor(context, query);

            return(result);
        }
Beispiel #4
0
        public virtual Doc Execute(Query query)
        {
            if (query == null)
            {
                return(null);
            }
            var db      = GetDatabase();
            var handler = QueryResolver.Resolve(query);

            return(handler.ExecuteProcedure(new MongoDbCRUDQueryExecutionContext(this, db), query));
        }
Beispiel #5
0
        public virtual Schema GetSchema(Query query)
        {
            if (query == null)
            {
                return(null);
            }

            var db = GetDatabase();

            var handler = QueryResolver.Resolve(query);

            return(handler.GetSchema(new MongoDBCRUDQueryExecutionContext(this, db), query));
        }
        public HobbyQuery()

        {
            Field <PersonType>("person",
                               arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                               resolve: context => QueryResolver.GetPerson(context.GetArgument <int>("id")));
            Field <HobbyType>("hobby",
                              arguments: new QueryArguments(new QueryArgument <IntGraphType> {
                Name = "id"
            }),
                              resolve: context => QueryResolver.GetHobby(context.GetArgument <int>("id")));
        }
Beispiel #7
0
        public void Arrange()
        {
            _validUserId = "someId";
            _validQuery  = "Query.GetUserState";

            var userRepository = new Mock <IUserRepository>();

            _resolver = new QueryResolver(userRepository.Object);

            userRepository.Setup(i => i.GetByIdOrDefaultAsync(It.Is <string>(x => x == _validUserId))).ReturnsAsync(new User {
                GameState = GameState.InGame
            });
            userRepository.Setup(i => i.GetByIdOrDefaultAsync(It.Is <string>(x => x != _validUserId))).ReturnsAsync(default(User));
        }
Beispiel #8
0
 public HobbyMutation()
 {
     Name = "CreateHobbyMutation";
     Field <HobbyType>(
         "createHobby",
         arguments: new QueryArguments(
             new QueryArgument <NonNullGraphType <HobbyInputType> > {
         Name = "hobby"
     }
             ),
         resolve: context =>
     {
         var hobby = context.GetArgument <Hobby>("hobby");
         return(QueryResolver.AddHobby(hobby));
     });
 }
Beispiel #9
0
        public dynamic SendQuery(string json)
        {
            try
            {
                dynamic query   = QueryResolver.ConvertToQuery(json);
                dynamic handler = QueryResolver.ResolveQueryHandler(query);

                return(handler.Handle(query));
            }
            catch
            {
                return(new SuccessInfoDto()
                {
                    isSuccess = false
                });
            }
        }
Beispiel #10
0
        public virtual int ExecuteWithoutFetch(params Query[] queries)
        {
            if (queries == null)
            {
                return(0);
            }

            var db       = GetDatabase();
            var affected = 0;

            foreach (var query in queries)
            {
                var handler = QueryResolver.Resolve(query);
                affected += handler.ExecuteWithoutFetch(new MongoDBCRUDQueryExecutionContext(this, db), query);
            }

            return(affected);
        }
Beispiel #11
0
        public virtual List <RowsetBase> Load(params Query[] queries)
        {
            CheckServiceActive();
            var result = new List <RowsetBase>();

            if (queries == null)
            {
                return(result);
            }

            foreach (var query in queries)
            {
                var handler = QueryResolver.Resolve(query);
                var rowset  = handler.Execute(new ErlCRUDQueryExecutionContext(this), query, false);
                result.Add(rowset);
            }

            return(result);
        }
Beispiel #12
0
        public virtual List <RowsetBase> Load(params Query[] queries)
        {
            var db = GetDatabase();

            var result = new List <RowsetBase>();

            if (queries == null)
            {
                return(result);
            }

            foreach (var query in queries)
            {
                var handler = QueryResolver.Resolve(query);
                var rowset  = handler.Execute(new MongoDBCRUDQueryExecutionContext(this, db), query, false);
                result.Add(rowset);
            }

            return(result);
        }
Beispiel #13
0
        public ErlDataStore(object director) : base(director)
        {
            m_QueryResolver = new QueryResolver(this);

            m_InstanceID = NFX.ExternalRandomGenerator.Instance.NextRandomUnsignedInteger;
        }
Beispiel #14
0
 public MySQLDataStore() : base()
 {
     m_QueryResolver = new QueryResolver(this);
 }
Beispiel #15
0
 public MySQLDataStore(string connectString) : base(connectString)
 {
     m_QueryResolver = new QueryResolver(this);
 }
Beispiel #16
0
 private void ctor(string cs = null)
 {
     m_QueryResolver = new QueryResolver(this);
     ConnectString   = cs;
 }
Beispiel #17
0
 private void ctor()
 {
     m_QueryResolver = new QueryResolver(this);
     m_Converter     = new DataDocConverter();
 }
Beispiel #18
0
 public MongoDBDataStore() : base()
 {
     m_QueryResolver = new QueryResolver(this);
     m_Converter     = new RowConverter();
 }
Beispiel #19
0
 public OrderTest()
 {
     mockLogger    = new Mock <ILogger <QueryResolver> >();
     queryResolver = new QueryResolver(mockLogger.Object);
 }
Beispiel #20
0
 public HobbyType()
 {
     Field(x => x.HobbyID).Description("Hobby ID");
     Field(x => x.Name).Description("Hobby Name");
     Field <IntGraphType>("PopularityCount", resolve: context => QueryResolver.GetPopularityCountForHobby(context.Source.HobbyID), description: "Count of people with this hobby");
 }
Beispiel #21
0
 public MongoDBDataStore(string connectString, string dbName) : base(connectString, dbName)
 {
     m_QueryResolver = new QueryResolver(this);
     m_Converter     = new RowConverter();
 }
Beispiel #22
0
 private void ctor()
 {
     m_QueryResolver = new QueryResolver(this);
 }