Exemple #1
0
        public async Task StartGame()
        {
            allAdoptions = (await adoptionRepository.Get()).ToList();

            contextProvider.Get().Reset();

            usedAdoptions.Clear();
            RefillAddoptions();
        }
        public ConferenceMutation(IContextProvider contextProvider)
        {
            _contextProvider = contextProvider;

            Field <IdGraphType>(
                "addConference",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ConferenceInputType> > {
                Name = "conference"
            }
                    ),
                resolve: context =>
            {
                var conference = context.GetArgument <Conference>("conference");
                var dataStore  = _contextProvider.Get <IDatastore>();
                return(dataStore.AddConferenceAsync(conference));
            });

            Field <IdGraphType>(
                "deleteConference",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id"
            }
                    ),
                resolve: context =>
            {
                var conferenceId = context.GetArgument <Guid>("id");
                var dataStore    = _contextProvider.Get <IDatastore>();
                return(dataStore.DeleteConferenceAsync(conferenceId));
            });

            Field <IdGraphType>(
                "editConference",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ConferenceInputType> > {
                Name = "conference"
            }
                    ),
                resolve: context =>
            {
                var conference = context.GetArgument <Conference>("conference");
                var dataStore  = _contextProvider.Get <IDatastore>();
                return(dataStore.EditConferenceAsync(conference));
            });
        }
Exemple #3
0
 public Repository(IContextProvider contextProvider)
 {
     this.context = contextProvider.Get(_type);
     if (context != null)
     {
         context.Log = new StringWriter();
     }
 }
Exemple #4
0
 public SiteObjectService(IContextProvider contextProvider)
 {
     this.context = (SpecialistDataContext)
                    contextProvider.Get(typeof(SiteObject));
     if (context != null)
     {
         context.Log = new StringWriter();
     }
 }
        public T Get <T>(string key, Func <string, T> getter) where T : class
        {
            var val = _contextProvider.Get <T>(key);

            if (val == null)
            {
                val = getter(key);
                _contextProvider.Set(key, val);
            }

            return(val);
        }
Exemple #6
0
                                                                      public Repository2(IContextProvider contextProvider)
                                                                      {
                                                                          context = contextProvider.Get(_type);
                                                                          context.DeferredLoadingEnabled = false;
                                                                          context.ObjectTrackingEnabled  = false;
#if (DEBUG)
                                                                          if (context != null)
                                                                          {
                                                                              context.Log = new StringWriter();
                                                                          }
#endif
                                                                      }
Exemple #7
0
        public ConferenceQuery(IContextProvider contextProvider)
        {
            _contextProvider = contextProvider;

            Field <ListGraphType <ConferenceType> >()
            .Name("Conferences")
            .ResolveAsync(async context =>
            {
                var dataStore = _contextProvider.Get <IDatastore>();
                return(await dataStore.GetAllConferencesAsync());
            });

            Field <ConferenceType>()
            .Name("Conference")
            //Arguments???
            .Argument <NonNullGraphType <IdGraphType> >("id", "id of the conference")
            .ResolveAsync(async context =>
            {
                var dataStore = _contextProvider.Get <IDatastore>();
                return(await dataStore.GetConferenceAsync(new Guid(context.GetArgument <string>("id"))));
            });

            Field <StringGraphType>(name: "hello", resolve: context => "world");
        }
Exemple #8
0
        public string Get()
        {
            var content = _contextProvider.Get <string>(Key);

            if (!string.IsNullOrEmpty(content))
            {
                return(content);
            }

            var request = _requestContextProvider.Get();

            content = GetRawContent(request);
            _contextProvider.Set(Key, content);

            return(content);
        }
        public void Intercept(IInvocation invocation)
        {
            InvocationContext invocationContext = invocationContextProvider.Get();

            Intercept(invocationContext, invocation);
        }
Exemple #10
0
 public PageService(IContextProvider contextProvider, IPageClient pageClient)
 {
     _context    = contextProvider.Get();
     _pageClient = pageClient;
 }
 public IModuleContext GetContext(ModuleContextNames contextName)
 {
     return(contextProvider.Get(contextName));
 }
 public DefaultController(IContextProvider contextProvider, IPageService pageService)
 {
     _pageService = pageService;
     _context     = contextProvider.Get();
 }
 public string Get()
 {
     return(_contextProvider.Get <string>(TokenKey));
 }