Exemple #1
0
    void ExecuteQueryWithContextImplementingDictionary()
    {
        #region ExecuteQueryWithContextImplementingDictionary

        ExecutionOptions options = new()
        {
            Schema      = schema,
            Query       = queryString,
            Inputs      = inputs,
            UserContext = new MyUserContext
                          (
                myProperty: "the value"
                          )
        };
        options.UseFluentValidation(validatorTypeCache);

        #endregion
    }

    void ExecuteQueryWithContextInsideDictionary()
    {
        #region ExecuteQueryWithContextInsideDictionary

        ExecutionOptions options = new()
        {
            Schema      = schema,
            Query       = queryString,
            Inputs      = inputs,
            UserContext = new Dictionary <string, object>
            {
                {
                    "MyUserContext",
                    new MyUserContext
                    (
                        myProperty: "the value"
                    )
                }
            }
        };
        options.UseFluentValidation(validatorTypeCache);

        #endregion
    }

    void NoContext()
    {
        #region NoContext

        ExecutionOptions options = new()
        {
            Schema = schema,
            Query  = queryString,
            Inputs = inputs
        };
        options.UseFluentValidation(validatorTypeCache);

        #endregion
    }
}
        public static async Task SeedAsync(MyUserContext contextuser)
        {
            var context = contextuser;



            using (context)
            {
                context.Database.Migrate();
                if (!context.User.Any())
                {
                    context.User.AddRange(
                        GetPreconfiguredUsers());
                    await context.SaveChangesAsync();
                }
            }
        }
 public bool Four(IResolveFieldContext resolveContext, [FromSource] object source, [FromUserContext] MyUserContext context, int id)
 {
     return(resolveContext != null && context != null && source != null && id != 0);
 }
 public bool Three(IResolveFieldContext resolveContext, [FromSource] object source, [FromUserContext] MyUserContext context)
 {
     return(resolveContext != null && context != null && source != null);
 }
 public string UserContextWithParam([FromUserContext] MyUserContext context, string id) => $"{context.Name} {id}";
 public string UserContext([FromUserContext] MyUserContext context) => context.Name;
 public UsersController(MyUserContext context)
 {
     _context = context;
 }