public WithMisNamedQueryChildGraph(IEfGraphQLService graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField <WithMisNamedQueryParentGraph, WithMisNamedQueryParentEntity>( name: "parent", resolve: context => context.Source.Parent); }
public LeaveRequestCommentType(IEfGraphQLService service) : base(service) { Field <DateTimeGraphType>("createdOn", resolve: ctx => ctx.Source.CreatedOn); Field <StringGraphType>("createdBy", resolve: ctx => ctx.Source.CreatedBy); Field <StringGraphType>("content", resolve: ctx => ctx.Source.Content); Field <CommentTypeEnum>("type", resolve: ctx => ctx.Source.Type); }
public AssetGraphQl(IEfGraphQLService <DatabaseContext> graphQlService, bool isEmptyLoad = false) : base(graphQlService) { if (!isEmptyLoad) { Field(x => x.Id); Field(x => x.Name); Field(x => x.Description, true); Field(x => x.Payload, true); Field(x => x.RootId); if (Core.Database.Config.Instance == Config.InstanceEnum.Core) { GetVulnerabilities(); } GetRisks(); GetTreatments(); GetGroups(); GetEvidences(); Field(x => x.IsDeleted); Field <DateTimeGraphType>( name: "createdDateTime", resolve: context => context.Source.CreatedDateTime); } }
public Query(IEfGraphQLService <MyDbContext> graphQlService) : base(graphQlService) { AddQueryConnectionField( name: "companies", resolve: context => context.DbContext.Companies); }
public DerivedChildGraph(IEfGraphQLService <IntegrationDbContext> graphQlService) : base(graphQlService) { AutoMap(new List <string> { "Parent", "TypedParent" }); }
public LactalisQuery(IEfGraphQLService <LactalisDBContext> efGraphQlService) : base(efGraphQlService) { // Add query types for each entity AddModelQueryField <TradingPostListingEntityType, TradingPostListingEntity>("TradingPostListingEntity"); AddModelQueryField <TradingPostCategoryEntityType, TradingPostCategoryEntity>("TradingPostCategoryEntity"); AddModelQueryField <AdminEntityType, AdminEntity>("AdminEntity"); AddModelQueryField <FarmEntityType, FarmEntity>("FarmEntity"); AddModelQueryField <MilkTestEntityType, MilkTestEntity>("MilkTestEntity"); AddModelQueryField <FarmerEntityType, FarmerEntity>("FarmerEntity"); AddModelQueryField <ImportantDocumentCategoryEntityType, ImportantDocumentCategoryEntity>("ImportantDocumentCategoryEntity"); AddModelQueryField <TechnicalDocumentCategoryEntityType, TechnicalDocumentCategoryEntity>("TechnicalDocumentCategoryEntity"); AddModelQueryField <QualityDocumentCategoryEntityType, QualityDocumentCategoryEntity>("QualityDocumentCategoryEntity"); AddModelQueryField <QualityDocumentEntityType, QualityDocumentEntity>("QualityDocumentEntity"); AddModelQueryField <TechnicalDocumentEntityType, TechnicalDocumentEntity>("TechnicalDocumentEntity"); AddModelQueryField <ImportantDocumentEntityType, ImportantDocumentEntity>("ImportantDocumentEntity"); AddModelQueryField <NewsArticleEntityType, NewsArticleEntity>("NewsArticleEntity"); AddModelQueryField <AgriSupplyDocumentCategoryEntityType, AgriSupplyDocumentCategoryEntity>("AgriSupplyDocumentCategoryEntity"); AddModelQueryField <SustainabilityPostEntityType, SustainabilityPostEntity>("SustainabilityPostEntity"); AddModelQueryField <AgriSupplyDocumentEntityType, AgriSupplyDocumentEntity>("AgriSupplyDocumentEntity"); AddModelQueryField <PromotedArticlesEntityType, PromotedArticlesEntity>("PromotedArticlesEntity"); // Add query types for each many to many reference AddModelQueryField <TradingPostListingsTradingPostCategoriesType, TradingPostListingsTradingPostCategories>("TradingPostListingsTradingPostCategories"); AddModelQueryField <FarmersFarmsType, FarmersFarms>("FarmersFarms"); }
public ProductGraph(IEfGraphQLService efGraphQlService) : base(efGraphQlService) { Field(x => x.ProductId); Field(x => x.ProductName); Field(x => x.ProductImage); Field(x => x.Discontinued); //Field(x => x.Supplier); //Field(x => x.Category); Field(x => x.QuantityPerUnit); Field(x => x.UnitPrice); Field(x => x.UnitsInStock); Field(x => x.UnitsOnOrder); Field(x => x.ReorderLevel); //AddNavigationField<CategoryGraph, Category>( // name: "category", // resolve: context => context.Source.Category); //AddNavigationField<SupplierGraph, Supplier>( // name: "supplier", // resolve: context => context.Source.Supplier); }
public MappingQuery( IEfGraphQLService <MappingContext> graphQlService) { graphQlService.AddSingleField( graph: this, name: "child", resolve: context => { return(context.DbContext.Children); }); graphQlService.AddQueryField( graph: this, name: "children", resolve: context => { return(context.DbContext.Children); }); graphQlService.AddSingleField( graph: this, name: "parent", resolve: context => { return(context.DbContext.Parents); }); graphQlService.AddQueryField( graph: this, name: "parents", resolve: context => { return(context.DbContext.Parents); }); }
public TechnicalDocumentEntityType(IEfGraphQLService <LactalisDBContext> service) : base(service) { // Add model fields to type Field(o => o.Id, type: typeof(IdGraphType)); Field(o => o.Created, type: typeof(DateTimeGraphType)); Field(o => o.Modified, type: typeof(DateTimeGraphType)); Field(o => o.FileId, type: typeof(IdGraphType)); Field(o => o.Name, type: typeof(StringGraphType)); // Add entity references Field(o => o.TechnicalDocumentCategoryId, type: typeof(IdGraphType)); // GraphQL reference to entity TechnicalDocumentCategoryEntity via reference TechnicalDocumentCategory AddNavigationField("TechnicalDocumentCategory", context => { var graphQlContext = (LactalisGraphQlContext)context.UserContext; var filter = SecurityService.CreateReadSecurityFilter <TechnicalDocumentCategoryEntity>( graphQlContext.IdentityService, graphQlContext.UserManager, graphQlContext.DbContext, graphQlContext.ServiceProvider); var value = context.Source.TechnicalDocumentCategory; if (value != null) { return(new List <TechnicalDocumentCategoryEntity> { value }.All(filter.Compile()) ? value : null); } return(null); }); }
public FarmerEntityType(IEfGraphQLService <LactalisDBContext> service) : base(service) { // Add model fields to type Field(o => o.Id, type: typeof(IdGraphType)); Field(o => o.Created, type: typeof(DateTimeGraphType)); Field(o => o.Modified, type: typeof(DateTimeGraphType)); Field(o => o.Email, type: typeof(StringGraphType)); // Add entity references // GraphQL reference to entity TradingPostListingEntity via reference TradingPostListings IEnumerable <TradingPostListingEntity> TradingPostListingssResolveFunction(ResolveFieldContext <FarmerEntity> context) { var graphQlContext = (LactalisGraphQlContext)context.UserContext; var filter = SecurityService.CreateReadSecurityFilter <TradingPostListingEntity>(graphQlContext.IdentityService, graphQlContext.UserManager, graphQlContext.DbContext, graphQlContext.ServiceProvider); return(context.Source.TradingPostListingss.Where(filter.Compile())); } AddNavigationListField("TradingPostListingss", (Func <ResolveFieldContext <FarmerEntity>, IEnumerable <TradingPostListingEntity> >)TradingPostListingssResolveFunction); AddNavigationConnectionField("TradingPostListingssConnection", TradingPostListingssResolveFunction); // GraphQL many to many reference to entity FarmEntity via reference Farms IEnumerable <FarmersFarms> FarmssResolveFunction(ResolveFieldContext <FarmerEntity> context) { var graphQlContext = (LactalisGraphQlContext)context.UserContext; var filter = SecurityService.CreateReadSecurityFilter <FarmersFarms>(graphQlContext.IdentityService, graphQlContext.UserManager, graphQlContext.DbContext, graphQlContext.ServiceProvider); return(context.Source.Farmss.Where(filter.Compile())); } AddNavigationListField("Farmss", (Func <ResolveFieldContext <FarmerEntity>, IEnumerable <FarmersFarms> >)FarmssResolveFunction); AddNavigationConnectionField("FarmssConnection", FarmssResolveFunction); }
public Query(IEfGraphQLService <BeawreContext> efGraphQlService) : base(efGraphQlService) { AddQueryField( name: "users", resolve: context => context.DbContext.User.Where(x => !x.IsDeleted) ); Field <ListGraphType <AssetGraphQl> >( name: "groups", resolve: context => { var dbContext = (BeawreContext)context.UserContext; var relationships = dbContext.Relationship.Where(x => x.FromType == ObjectType.AssetGroup && !x.IsDeleted).Select(x => x.FromId).ToArray(); return(dbContext.Assets.Where(x => relationships.Contains(x.Id) && !x.IsDeleted && x.IsGroup).ToList()); }); AddQueryField( name: "containers", resolve: context => context.DbContext.Container.Where(x => !x.IsDeleted) ); AddQueryField( name: "assets", resolve: context => context.DbContext.Assets.Where(x => !x.IsDeleted) ); AddQueryField( name: "edges", resolve: context => context.DbContext.Relationship.Where(x => x.FromType == ObjectType.Asset && x.ToType == ObjectType.Asset).Where(x => !x.IsDeleted) ); }
public DependencyQuery(IEfGraphQLService <DependencyDbContext> efGraphQlService) : base(efGraphQlService) { AddQueryField( name: "entities", resolve: context => context.DbContext.Entities); }
public Query(IEfGraphQLService efGraphQlService) : base(efGraphQlService) { AddQueryField <CompanyGraph, Company>( name: "companies", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Companies); }); AddQueryConnectionField <CompanyGraph, Company>( name: "companiesConnection", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Companies); }); AddQueryField <EmployeeGraph, Employee>( name: "employees", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Employees); }); AddQueryConnectionField <EmployeeGraph, Employee>( name: "employeesConnection", resolve: context => { var dataContext = (MyDataContext)context.UserContext; return(dataContext.Employees); }); }
public Level2Graph(IEfGraphQLService graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField <Level3Graph, Level3Entity>( name: "level3Entity", resolve: context => context.Source.Level3Entity); }
public MilkTestEntityType(IEfGraphQLService <LactalisDBContext> service) : base(service) { // Add model fields to type Field(o => o.Id, type: typeof(IdGraphType)); Field(o => o.Created, type: typeof(DateTimeGraphType)); Field(o => o.Modified, type: typeof(DateTimeGraphType)); Field(o => o.Time, type: typeof(DateTimeGraphType)); Field(o => o.Volume, type: typeof(IntGraphType)); Field(o => o.Temperature, type: typeof(FloatGraphType)); Field(o => o.MilkFat, type: typeof(FloatGraphType)); Field(o => o.Protein, type: typeof(FloatGraphType)); // Add entity references Field(o => o.FarmId, type: typeof(IdGraphType)); // GraphQL reference to entity FarmEntity via reference Farm AddNavigationField("Farm", context => { var graphQlContext = (LactalisGraphQlContext)context.UserContext; var filter = SecurityService.CreateReadSecurityFilter <FarmEntity>( graphQlContext.IdentityService, graphQlContext.UserManager, graphQlContext.DbContext, graphQlContext.ServiceProvider); var value = context.Source.Farm; if (value != null) { return(new List <FarmEntity> { value }.All(filter.Compile()) ? value : null); } return(null); }); }
public GraphQLQuery(IEfGraphQLService <BlogContext> graphQlService) : base(graphQlService) { AddQueryField(name: "posts", resolve: ctx => ctx.DbContext.Post); AddSingleField(name: "post", resolve: ctx => ctx.DbContext.Post); AddQueryField(name: "users", resolve: ctx => ctx.DbContext.User); AddSingleField(name: "user", resolve: ctx => ctx.DbContext.User); }
public CompanyGraph(IEfGraphQLService <MyDbContext> graphQlService) : base(graphQlService) { AddNavigationConnectionField( name: "employees", resolve: context => context.Source.Employees); }
public CrowdactionTagGraph(IEfGraphQLService <ApplicationDbContext> entityFrameworkGraphQlService) : base(entityFrameworkGraphQlService) { Field <NonNullGraphType <IdGraphType>, int>(nameof(CrowdactionTag.CrowdactionId)).Resolve(x => x.Source.CrowdactionId); Field <NonNullGraphType <IdGraphType>, int>(nameof(CrowdactionTag.TagId)).Resolve(x => x.Source.TagId); AddNavigationField(nameof(CrowdactionTag.Crowdaction), c => c.Source.Crowdaction); AddNavigationField(nameof(CrowdactionTag.Tag), c => c.Source.Tag); }
public TaskGraph(IEfGraphQLService graphQlService) : base(graphQlService) { Field(x => x.Id); /* AddNavigationField<EmployeeGraph, Employee>( * name: "employees", * resolve: context => context.Source.Employees);*/ }
public SkipLevelGraph(IEfGraphQLService graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField(name: "level3Entity", resolve: context => context.Source.Level2Entity.Level3Entity, graphType: typeof(Level3Graph), includeNames: new[] { "Level2Entity.Level3Entity" }); }
public WithMisNamedQueryChildGraph(IEfGraphQLService <IntegrationDbContext> graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField( name: "parent", resolve: context => context.Source.Parent); }
public EmployeeGraph(IEfGraphQLService graphQlService) : base(graphQlService) { Field(x => x.Id); Field(x => x.Content); AddNavigationField <CompanyGraph, Company>( name: "company", resolve: context => context.Source.Company); }
public UserEventGraph(IEfGraphQLService <ApplicationDbContext> entityFrameworkGraphQlService) : base(entityFrameworkGraphQlService) { Field(x => x.Id); Field(x => x.EventData); Field <NonNullGraphType <DateTimeOffsetGraphType>, DateTime>(nameof(UserEvent.EventLoggedAt)).Resolve(x => x.Source.EventLoggedAt); Field(x => x.UserId, true); AddNavigationField(nameof(UserEvent.User), c => c.Source.User, typeof(ApplicationUserGraph)); }
public PostGraph(IEfGraphQLService <BlogDbContext> graphService) : base(graphService) { Field(x => x.PostId, type: typeof(IdGraphType)); Field(x => x.Title, nullable: true); Field(x => x.PostedAt, nullable: true); Field(x => x.UserId, nullable: true, type: typeof(IdGraphType)); AddNavigationField(name: "User", resolve: context => context.Source.User); }
public RestrictedApplicationUserGraph(IEfGraphQLService <ApplicationDbContext> efGraphQlService) : base(efGraphQlService) { Field <NonNullGraphType <IdGraphType>, string>(nameof(ApplicationUser.Id)).Resolve(x => x.Source.Id); Field(x => x.FirstName, true); Field(x => x.FullName, true); Field(x => x.LastName, true); Field(x => x.Email).AuthorizeWith(AuthorizationConstants.GraphQlAdminPolicy); }
public IncludeNonQueryableAGraph(IEfGraphQLService <IntegrationDbContext> graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField( name: "includeNonQueryableB", resolve: context => context.Source.IncludeNonQueryableB); }
public DonationEventLogGraph(IEfGraphQLService <ApplicationDbContext> entityFrameworkGraphQlService) : base(entityFrameworkGraphQlService) { Field <NonNullGraphType <IdGraphType>, int>(nameof(DonationEventLog.Id)).Resolve(x => x.Source.Id); Field(x => x.UserId, true); Field(x => x.EventData); AddNavigationField(nameof(DonationEventLog.User), c => c.Source.User, typeof(ApplicationUserGraph)).AuthorizeWith(AuthorizationConstants.GraphQlAdminPolicy); }
public Level1Graph(IEfGraphQLService <IntegrationDbContext> graphQlService) : base(graphQlService) { Field(x => x.Id); AddNavigationField( name: "level2Entity", resolve: context => context.Source.Level2Entity); }
public AddressGraph(IEfGraphQLService <BlogDbContext> graphService) : base(graphService) { Field(x => x.AddressId, type: typeof(IdGraphType)); Field(x => x.Name, nullable: true); Field(x => x.PostalNumber, nullable: true, type: typeof(IntGraphType)); Field(x => x.CountryId, nullable: true, type: typeof(IdGraphType)); AddNavigationField(name: "Country", resolve: context => context.Source.Country); }
public InterfaceGraph(IEfGraphQLService <IntegrationDbContext> graphQlService) : base(graphQlService) { Field(e => e.Id); Field(e => e.Property, nullable: true); AddNavigationConnectionField <DerivedChildEntity>( name: "childrenFromInterface", includeNames: new[] { "ChildrenFromBase" }); }