Ejemplo n.º 1
0
        public RootGraphQLMutation(
            IHttpContextAccessor context,
            UserManager <ApplicationUser> users,
            GraphQLUserContextAccessor accessor,
            FarmMasterContext fmDb,
            IdentityContext idDb,
            IAuthorizationService auth,

            IEnumerable <IGraphQLMutationProvider> providers
            ) : base(context, users, accessor, fmDb, idDb, auth)
        {
            foreach (var provider in providers)
            {
                provider.AddMutations(this);
            }
        }
Ejemplo n.º 2
0
        public RootGraphQLQuery(
            // Required for RootBase
            IHttpContextAccessor context,
            UserManager <ApplicationUser> users,
            GraphQLUserContextAccessor accessor,
            FarmMasterContext fmDb,
            IdentityContext idDb,
            IAuthorizationService auth,

            // Extern providers
            IEnumerable <IGraphQLQueryProvider> providers
            ) : base(context, users, accessor, fmDb, idDb, auth)
        {
            foreach (var provider in providers)
            {
                provider.AddQueries(this);
            }
        }
Ejemplo n.º 3
0
        public RootBase(
            IHttpContextAccessor context,
            UserManager <ApplicationUser> users,
            GraphQLUserContextAccessor accessor,
            FarmMasterContext fmDb,
            IdentityContext idDb,
            IAuthorizationService auth
            )
        {
            var user = users.GetUserAsync(context.HttpContext.User).Result;

            accessor.Context = new DataAccessUserContext(user, context.HttpContext.User, auth);
            if (user == null)
            {
                throw new ExecutionError("You are not logged in");
            }

            this.DataContext  = accessor.Context;
            this.FarmMasterDb = fmDb;
            this.IdentityDb   = idDb;
            this.UserManager  = users;
        }