public static void RegisterInContainer(Action <Type, object> registerInstance, DbContext dbContext)
        {
            Guard.AgainstNull(nameof(registerInstance), registerInstance);
            Guard.AgainstNull(nameof(dbContext), dbContext);
            Scalars.RegisterInContainer(registerInstance);
            ArgumentGraphs.RegisterInContainer(registerInstance);

            var service = new EfGraphQLService(dbContext);

            registerInstance(typeof(IEfGraphQLService), service);
        }
예제 #2
0
        public static void RegisterInContainer(Action <Type, object> register, IModel model, GlobalFilters filters = null)
        #endregion
        {
            Guard.AgainstNull(nameof(register), register);
            Guard.AgainstNull(nameof(model), model);
            Scalars.RegisterInContainer(register);
            ArgumentGraphs.RegisterInContainer(register);

            if (filters == null)
            {
                filters = new GlobalFilters();
            }

            var service = new EfGraphQLService(model, filters);

            register(typeof(IEfGraphQLService), service);
        }
예제 #3
0
        public static void RegisterInContainer <TDbContext>(
            Action <Type, object> register,
            TDbContext dbContext,
            DbContextFromUserContext <TDbContext> dbContextFromUserContext,
            GlobalFilters filters = null)
            where TDbContext : DbContext
        #endregion
        {
            Guard.AgainstNull(nameof(register), register);
            Guard.AgainstNull(nameof(dbContextFromUserContext), dbContextFromUserContext);
            Guard.AgainstNull(nameof(dbContext), dbContext);
            Scalars.RegisterInContainer(register);
            ArgumentGraphs.RegisterInContainer(register);

            if (filters == null)
            {
                filters = new GlobalFilters();
            }

            var service = new EfGraphQLService <TDbContext>(dbContext.Model, filters, dbContextFromUserContext);

            register(typeof(IEfGraphQLService <TDbContext>), service);
        }