예제 #1
0
        public EfGraphQLService(
            IModel model,
            ResolveDbContext <TDbContext> resolveDbContext,
            ResolveFilters resolveFilters = null)
        {
            Guard.AgainstNull(nameof(model), model);
            Guard.AgainstNull(nameof(resolveDbContext), resolveDbContext);
            this.resolveFilters = resolveFilters;

            this.resolveDbContext = resolveDbContext;
            foreach (var entityType in model.GetEntityTypes())
            {
                var primaryKey = entityType.FindPrimaryKey();
                //This can happen for views
                if (primaryKey == null)
                {
                    continue;
                }

                var names = primaryKey.Properties.Select(x => x.Name).ToList();
                keyNames.Add(entityType.ClrType, names);
            }

            includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
        }
예제 #2
0
        public EfGraphQLService(IModel model, GlobalFilters filters)
        {
            Guard.AgainstNull(nameof(model), model);
            this.filters = filters;
            foreach (var entityType in model.GetEntityTypes())
            {
                var names = entityType.FindPrimaryKey().Properties.Select(x => x.Name).ToList();
                keyNames.Add(entityType.ClrType, names);
            }

            includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
        }
        public EfGraphQLService(
            IModel model,
            ResolveDbContext <TDbContext> resolveDbContext,
            ResolveFilters?resolveFilters = null)
        {
            Guard.AgainstNull(nameof(model), model);
            Guard.AgainstNull(nameof(resolveDbContext), resolveDbContext);
            this.resolveFilters = resolveFilters;

            this.resolveDbContext = resolveDbContext;

            keyNames = model.GetKeyNames();

            includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
        }
예제 #4
0
        /// <param name="disableTracking">Use <see cref="EntityFrameworkQueryableExtensions.AsNoTracking{TEntity}"/> for all <see cref="IQueryable{T}"/> operations.</param>
        public EfGraphQLService(
            IModel model,
            ResolveDbContext <TDbContext> resolveDbContext,
            ResolveFilters?resolveFilters = null,
            bool disableTracking          = false)
        {
            this.resolveFilters  = resolveFilters;
            this.disableTracking = disableTracking;

            this.resolveDbContext = resolveDbContext;

            keyNames = model.GetKeyNames();

            Navigations     = NavigationReader.GetNavigationProperties(model);
            includeAppender = new(Navigations);
        }
예제 #5
0
        public EfGraphQLService(IModel model, GlobalFilters filters, Func <object, TDbContext> dbContextFromUserContext)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            this.filters = filters;
            this.dbContextFromUserContext = dbContextFromUserContext ?? throw new ArgumentNullException(nameof(dbContextFromUserContext));
            foreach (var entityType in model.GetEntityTypes())
            {
                var primaryKey = entityType.FindPrimaryKey();
                //This can happen for views
                if (primaryKey == null)
                {
                    continue;
                }

                var names = primaryKey.Properties.Select(x => x.Name).ToList();
                keyNames.Add(entityType.ClrType, names);
            }

            includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
        }
예제 #6
0
 public EntityGraphAdapter(EdmModel model, GlobalFilters filters)
 {
     // Guard.AgainstNull(nameof(model), model);
     this.filters    = filters;
     includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
 }
 public EfGraphQLService(DbContext dbContext)
 {
     Guard.AgainstNull(nameof(dbContext), dbContext);
     includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(dbContext));
 }
 public EfGraphQLService(IModel model, GlobalFilters filters)
 {
     Guard.AgainstNull(nameof(model), model);
     this.filters    = filters;
     includeAppender = new IncludeAppender(NavigationReader.GetNavigationProperties(model));
 }