public FlightKitDataAccessQuery(ICommandHandlerFactory commandHandlerFactory) { Name = "Query"; _commandHandlerFactory = commandHandlerFactory; FieldAsync <RiskReportType>("riskReportByReportId", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "reportId", Description = "Report Identifier" }, new QueryArgument <BooleanGraphType> { Name = "includeSyncMetadata", Description = "If returns the data with sync metadata", DefaultValue = false }), resolve: async context => { var id = context.GetArgument <Guid>("reportId"); var includesSyncMetadata = context.GetArgument <bool>("includeSyncMetadata"); GetRiskReportByReportIdCommand command = new GetRiskReportByReportIdCommand { ReportId = id, IncludeSyncMetadata = includesSyncMetadata }; var report = await _commandHandlerFactory. RequestCommandHandler <GetRiskReportByReportIdCommand, RiskReport>().HandleAsync(command) .ConfigureAwait(false); return(report); }); FieldAsync <ListGraphType <RiskReportType> >("riskReportsByRiskId", arguments: new QueryArguments( new QueryArgument <StringGraphType> { Name = "riskId", Description = "Risk Id" }, new QueryArgument <BooleanGraphType> { Name = "includeSyncMetadata", Description = "If returns the data with sync metadata", DefaultValue = false }), resolve: async context => { var riskId = context.GetArgument <string>("riskId"); var includesSyncMetadata = context.GetArgument <bool>("includeSyncMetadata"); GetRiskReportsByRiskIdCommand command = new GetRiskReportsByRiskIdCommand { RiskId = riskId, IncludeSyncMetadata = includesSyncMetadata }; var reports = await _commandHandlerFactory .RequestCommandHandler <GetRiskReportsByRiskIdCommand, ICollection <RiskReport> >() .HandleAsync(command).ConfigureAwait(false); return(reports); }); SyncMetadataFieldAsync <Risk_Report, RiskReport, RiskReportType>(r => r); SyncMetadataFieldAsync <Risk_AdditionDate, RiskAdditionDate, RiskAdditionDateType>(r => r.AdditionDates); SyncMetadataFieldAsync <Risk_Comment, RiskComment, RiskCommentType>(r => r.Comments); SyncMetadataFieldAsync <Risk_CommentSegment, RiskCommentSegment, RiskCommentSegmentType>(r => r.Comments.SelectMany(c => c.CommentSegments)); SyncMetadataFieldAsync <Risk_Exposure, RiskExposure, RiskExposureType>(r => r.Exposures); SyncMetadataFieldAsync <Risk_FireDivisionRisk, RiskFireDivisionRisk, RiskFireDivisionRiskType>(r => r.FireDivisionRisks); SyncMetadataFieldAsync <Risk_FloorsAndRoof, RiskFloorsAndRoof, RiskFloorsAndRoofType>(r => r.FloorsAndRoofs); SyncMetadataFieldAsync <Risk_InternalProtection, RiskInternalProtection, RiskInternalProtectionType>(r => r.InternalProtections); SyncMetadataFieldAsync <Risk_Occupant, RiskOccupant, RiskOccupantType>(r => r.Occupants); SyncMetadataFieldAsync <Risk_OccupantLevel, RiskOccupantLevel, RiskOccupantLevelType>(r => r.Occupants.SelectMany(o => o.OccupantLevels)); SyncMetadataFieldAsync <Risk_OccupantHazard, RiskOccupantHazard, RiskOccupantHazardType>(r => r.Occupants.SelectMany(o => o.OccupantHazards)); SyncMetadataFieldAsync <Risk_ProtectionSafeguard, RiskProtectionSafeguard, RiskProtectionSafeguardType>(r => r.ProtectionSafeguards); SyncMetadataFieldAsync <Risk_ReportAddress, RiskReportAddress, RiskReportAddressType>(r => r.ReportAddresses); SyncMetadataFieldAsync <Risk_ReportAttachment, RiskReportAttachment, RiskReportAttachmentType>(r => r.ReportAttachments); SyncMetadataFieldAsync <Risk_ReportBuildingInformation, RiskReportBuildingInformation, RiskReportBuildingInformationType>(r => r.ReportBuildingInformations); SyncMetadataFieldAsync <Risk_ReportHazard, RiskReportHazard, RiskReportHazardType>(r => r.ReportHazards); SyncMetadataFieldAsync <Risk_ReportPhoto, RiskReportPhoto, RiskReportPhotoType>(r => r.ReportPhotoes); SyncMetadataFieldAsync <Risk_ReportRelatedDate, RiskReportRelatedDate, RiskReportRelatedDateType>(r => r.ReportRelatedDates); SyncMetadataFieldAsync <Risk_RetiredOccupantNumber, RiskRetiredOccupantNumber, RiskRetiredOccupantNumberType>(r => r.RetiredOccupantNumbers); SyncMetadataFieldAsync <Risk_SecondaryConstruction, RiskSecondaryConstruction, RiskSecondaryConstructionType>(r => r.SecondaryConstructions); SyncMetadataFieldAsync <Risk_Wall, RiskWall, RiskWallType>(r => r.Walls); }