Exemple #1
0
        public GqlHeroSkill(FehContextFactory dbContextFactory, IDataLoaderContextAccessor accessor)
        {
            this.Name = nameof(HeroSkill);

            this.Field(nameof(HeroSkill.DefaultRarity), x => x.DefaultRarity, nullable: true);
            this.Field(nameof(HeroSkill.HeroId), x => x.HeroId);
            this.Field(nameof(HeroSkill.Id), x => x.Id);
            this.Field(nameof(HeroSkill.SkillId), x => x.SkillId);
            this.Field(nameof(HeroSkill.SkillPosition), x => x.SkillPosition);
            this.Field(nameof(Skill.SkillType), x => (int)x.Skill.SkillType);
            this.Field(nameof(HeroSkill.UnlockRarity), x => x.UnlockRarity);

            /* Data Loader */

            this
            .Field <GqlSkill, Skill>()
            .Name(nameof(HeroSkill.Skill))
            .ResolveAsync(
                (context) =>
            {
                var service = new SkillService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddBatchLoader <Guid, Skill>(
                    $"{nameof(Skill)}_{nameof(SkillService.GetByIdsAsync)}",
                    service.GetByIdsAsync
                    );

                return(loader.LoadAsync(context.Source.SkillId));
            }
                );
        }
Exemple #2
0
        public GqlHeroVoiceActor(FehContextFactory dbContextFactory, IDataLoaderContextAccessor accessor)
        {
            this.Name = nameof(HeroVoiceActor);

            this.Field(nameof(HeroVoiceActor.HeroId), x => x.HeroId);
            this.Field(nameof(HeroVoiceActor.Id), x => x.Id);
            this.Field(nameof(HeroVoiceActor.Language), x => (int)x.Language);
            this.Field(nameof(HeroVoiceActor.Sort), x => x.Sort);
            this.Field(nameof(HeroVoiceActor.VoiceActorId), x => x.VoiceActorId);

            /* Data Loader */

            this
            .Field <GqlVoiceActor, VoiceActor>()
            .Name(nameof(HeroVoiceActor.VoiceActor))
            .ResolveAsync(
                (context) =>
            {
                var service = new VoiceActorService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddBatchLoader <int, VoiceActor>(
                    $"{nameof(VoiceActor)}_{nameof(VoiceActorService.GetByIdsAsync)}",
                    service.GetByIdsAsync
                    );

                return(loader.LoadAsync(context.Source.VoiceActorId));
            }
                );
        }
        public ExtractHeroAssetsScript(FehContextFactory dbContextFactory, string sourceDirectory, string targetDirectory, bool overwrite = false)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceDirectory = sourceDirectory;
            this._targetDirectory = targetDirectory;

            this._overwrite = overwrite;
        }
        public ImportHeroesScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;

            this._artistMap = this._dbContext
                              .Artists
                              .ToDictionaryAsync(
                x => x.Name.ToLower(),
                y => y
                )
                              .Result;
        }
Exemple #5
0
        public ImportHeroSkillsScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;

            this._heroMap = this._dbContext
                            .Heroes
                            .ToDictionaryAsync(
                x => x.Tag,
                y => y
                )
                            .Result;

            this._skillMap = this._dbContext
                             .Skills
                             .ToDictionaryAsync(
                x => x.Tag,
                y => y
                )
                             .Result;
        }
Exemple #6
0
        public ImportVoiceActorsScript(FehContextFactory dbContextFactory, string sourceFile)
        {
            this._dbContext = dbContextFactory.CreateDbContext();

            this._sourceFiile = sourceFile;
        }
Exemple #7
0
        public GqlSkill(FehContextFactory dbContextFactory, IDataLoaderContextAccessor accessor)
        {
            this.Name = nameof(Skill);

            this.Field(nameof(Skill.AttackModifier), x => x.AttackModifier, nullable: true);
            this.Field(nameof(Skill.Cooldown), x => x.Cooldown, nullable: true);
            this.Field(nameof(Skill.CreatedAt), x => x.CreatedAt, type: typeof(DateTimeGraphType));
            this.Field(nameof(Skill.CreatedBy), x => x.CreatedBy);
            this.Field(nameof(Skill.DefenseModifier), x => x.DefenseModifier, nullable: true);
            this.Field(nameof(Skill.Description), x => x.Description, nullable: true);
            this.Field(nameof(Skill.GroupName), x => x.GroupName);
            this.Field(nameof(Skill.HitPointsModifier), x => x.HitPointsModifier, nullable: true);
            this.Field(nameof(Skill.Id), x => x.Id);
            this.Field(nameof(Skill.IsAvailableAsSacredSeal), x => x.IsAvailableAsSacredSeal);
            this.Field(nameof(Skill.IsExclusive), x => x.IsExclusive);
            this.Field(nameof(Skill.Might), x => x.Might, nullable: true);
            this.Field(nameof(Skill.ModifiedAt), x => x.ModifiedAt, type: typeof(DateTimeGraphType));
            this.Field(nameof(Skill.ModifiedBy), x => x.ModifiedBy);
            this.Field(nameof(Skill.Name), x => x.Name);
            this.Field(nameof(Skill.Range), x => x.Range, nullable: true);
            this.Field(nameof(Skill.ResistanceModifier), x => x.ResistanceModifier, nullable: true);
            this.Field(nameof(Skill.SkillPoints), x => x.SkillPoints);
            this.Field(nameof(Skill.SkillType), x => (int)x.SkillType);
            this.Field(nameof(Skill.SpeedModifier), x => x.SpeedModifier, nullable: true);
            this.Field(nameof(Skill.Tag), x => x.Tag);
            this.Field(nameof(Skill.Version), x => x.Version);
            this.Field(nameof(Skill.WeaponRefineType), x => (int?)x.WeaponRefineType, nullable: true);

            /* Data Loader */

            this
            .Field <ListGraphType <GqlSkillMovementType>, IEnumerable <SkillMovementType> >()
            .Name(nameof(Skill.SkillMovementTypes))
            .ResolveAsync(
                (context) =>
            {
                var service = new SkillMovementTypeService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddCollectionBatchLoader <Guid, SkillMovementType>(
                    $"{nameof(SkillMovementType)}_{nameof(SkillMovementTypeService.GetBySkillIdsAsync)}",
                    service.GetBySkillIdsAsync
                    );

                return(loader.LoadAsync(context.Source.Id));
            }
                );

            this
            .Field <ListGraphType <GqlSkillWeaponEffectiveness>, IEnumerable <SkillWeaponEffectiveness> >()
            .Name(nameof(Skill.SkillWeaponEffectivenesses))
            .ResolveAsync(
                (context) =>
            {
                var service = new SkillWeaponEffectivenessService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddCollectionBatchLoader <Guid, SkillWeaponEffectiveness>(
                    $"{nameof(SkillWeaponEffectiveness)}_{nameof(SkillWeaponEffectivenessService.GetBySkillIdsAsync)}",
                    service.GetBySkillIdsAsync
                    );

                return(loader.LoadAsync(context.Source.Id));
            }
                );

            this
            .Field <ListGraphType <GqlSkillWeaponType>, IEnumerable <SkillWeaponType> >()
            .Name(nameof(Skill.SkillWeaponTypes))
            .ResolveAsync(
                (context) =>
            {
                var service = new SkillWeaponTypeService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddCollectionBatchLoader <Guid, SkillWeaponType>(
                    $"{nameof(SkillWeaponType)}_{nameof(SkillWeaponTypeService.GetBySkillIdsAsync)}",
                    service.GetBySkillIdsAsync
                    );

                return(loader.LoadAsync(context.Source.Id));
            }
                );
        }
Exemple #8
0
        public static int Main(string[] args)
        {
            var application = new CommandLineApplication()
            {
                Name        = "FEHub.Utilities",
                Description = "A collection of utility scripts for the FEHub application.",
            };

            application.HelpOption("-?|-h|--help");

            var sourcePath = application.Option(
                "-s|--source",
                "The source path.",
                CommandOptionType.SingleValue
                );

            var targetPath = application.Option(
                "-t|--target",
                "The target path.",
                CommandOptionType.SingleValue
                );

            #region Import

            var importAccessories = application.Option(
                "--importAccessories",
                "Import accessory data.",
                CommandOptionType.NoValue
                );

            var importArtists = application.Option(
                "--importArtists",
                "Import artist data.",
                CommandOptionType.NoValue
                );

            var importHeroes = application.Option(
                "--importHeroes",
                "Import hero data.",
                CommandOptionType.NoValue
                );

            var importHeroSkills = application.Option(
                "--importHeroSkills",
                "Import hero skill data.",
                CommandOptionType.NoValue
                );

            var importHeroVoiceActors = application.Option(
                "--importHeroVoiceActors",
                "Import hero voice actor data.",
                CommandOptionType.NoValue
                );

            var importItems = application.Option(
                "--importItems",
                "Import item data.",
                CommandOptionType.NoValue
                );

            var importSkills = application.Option(
                "--importSkills",
                "Import skill data.",
                CommandOptionType.NoValue
                );

            var importVoiceActors = application.Option(
                "--importVoiceActors",
                "Import voice actor data.",
                CommandOptionType.NoValue
                );

            #endregion

            #region Miscellaneous

            var extractHeroAssets = application.Option(
                "--extractHeroAssets",
                "Extract the associated hero assets into a standard format.",
                CommandOptionType.NoValue
                );

            var extractSkillAssets = application.Option(
                "--extractSkillAssets",
                "Extract the associated skill assets into a standard format.",
                CommandOptionType.NoValue
                );

            var splitSkillIcons = application.Option(
                "--splitSkillIcons",
                "Splits the skill icons.",
                CommandOptionType.NoValue
                );

            #endregion

            #region Scrape

            var scrapeAccessories = application.Option(
                "--scrapeAccessories",
                "Scrape accessory data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeArtists = application.Option(
                "--scrapeArtists",
                "Scrape artist data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeHeroes = application.Option(
                "--scrapeHeroes",
                "Scrape hero data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeHeroSkills = application.Option(
                "--scrapeHeroSkills",
                "Scrape hero skill data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeItems = application.Option(
                "--scrapeItems",
                "Scrape item data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeSacredSealCosts = application.Option(
                "--scrapeSacredSealCosts",
                "Scrape sacred seal cost data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeSkills = application.Option(
                "--scrapeSkills",
                "Scrape skill data from the wiki.",
                CommandOptionType.NoValue
                );

            var scrapeVoiceActors = application.Option(
                "--scrapeVoiceActors",
                "Scrape voice actor data from the wiki.",
                CommandOptionType.NoValue
                );

            #endregion

            #region Upload

            var uploadHeroAssets = application.Option(
                "--uploadHeroAssets",
                "Uploads hero assets to AWS S3.",
                CommandOptionType.NoValue
                );

            var uploadSkillAssets = application.Option(
                "--uploadSkillAssets",
                "Uploads skill assets to AWS S3.",
                CommandOptionType.NoValue
                );

            #endregion

            application.OnExecuteAsync(
                async(cancellationToken) =>
            {
                var dbContextFactory = new FehContextFactory();

                #region Import

                if (importAccessories.HasValue())
                {
                    await new ImportAccessoriesScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importArtists.HasValue())
                {
                    await new ImportArtistsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importHeroes.HasValue())
                {
                    await new ImportHeroesScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importHeroSkills.HasValue())
                {
                    await new ImportHeroSkillsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importHeroVoiceActors.HasValue())
                {
                    await new ImportHeroVoiceActorsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importItems.HasValue())
                {
                    await new ImportItemsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importSkills.HasValue())
                {
                    await new ImportSkillsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                if (importVoiceActors.HasValue())
                {
                    await new ImportVoiceActorsScript(
                        dbContextFactory,
                        sourceFile: sourcePath.Value()
                        ).RunAsync();
                }

                #endregion

                #region Miscellaneous

                if (extractHeroAssets.HasValue())
                {
                    await new ExtractHeroAssetsScript(
                        dbContextFactory,
                        sourceDirectory: sourcePath.Value(),
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (extractSkillAssets.HasValue())
                {
                    await new ExtractSkillAssetsScript(
                        dbContextFactory,
                        sourceDirectory: sourcePath.Value(),
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (splitSkillIcons.HasValue())
                {
                    await new SplitSkillIconsScript(
                        sourceFile: sourcePath.Value(),
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                #endregion

                #region Scrape

                if (scrapeAccessories.HasValue())
                {
                    await new ScrapeAccessoriesScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeArtists.HasValue())
                {
                    await new ScrapeArtistsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeHeroes.HasValue())
                {
                    await new ScrapeHeroesScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeHeroSkills.HasValue())
                {
                    await new ScrapeHeroSkillsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeItems.HasValue())
                {
                    await new ScrapeItemsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeSacredSealCosts.HasValue())
                {
                    await new ScrapeSacredSealCostsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeSkills.HasValue())
                {
                    await new ScrapeSkillsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                if (scrapeVoiceActors.HasValue())
                {
                    await new ScrapeVoiceActorsScript(
                        targetDirectory: targetPath.Value()
                        ).RunAsync();
                }

                #endregion

                #region Upload

                if (uploadHeroAssets.HasValue())
                {
                    await new UploadHeroAssetsScript(
                        sourceDirectory: sourcePath.Value()
                        ).RunAsync();
                }

                if (uploadSkillAssets.HasValue())
                {
                    await new UploadSkillAssetsScript(
                        sourceDirectory: sourcePath.Value()
                        ).RunAsync();
                }

                #endregion

                return(0);
            }
                );

            return(application.Execute(args));
        }
Exemple #9
0
        public GqlQuery(FehContextFactory dbContextFactory)
        {
            this
            .Field <ListGraphType <GqlAccessory>, List <Accessory> >()
            .Name("accessories")
            .ResolveAsync(
                (context) =>
            {
                var service = new AccessoryService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlAccessory, Accessory>()
            .Name("accessory")
            .Argument <NonNullGraphType <GuidGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <Guid>("id");

                var service = new AccessoryService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );

            this
            .Field <ListGraphType <GqlArtist>, List <Artist> >()
            .Name("artists")
            .ResolveAsync(
                (context) =>
            {
                var service = new ArtistService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlArtist, Artist>()
            .Name("artist")
            .Argument <NonNullGraphType <IntGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <int>("id");

                var service = new ArtistService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );

            this
            .Field <GqlEnumerations>()
            .Name("enumerations")
            .Resolve(x => new { });

            this
            .Field <ListGraphType <GqlHero>, List <Hero> >()
            .Name("heroes")
            .ResolveAsync(
                (context) =>
            {
                var service = new HeroService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlHero, Hero>()
            .Name("hero")
            .Argument <NonNullGraphType <GuidGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <Guid>("id");

                var service = new HeroService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );

            this
            .Field <ListGraphType <GqlItem>, List <Item> >()
            .Name("items")
            .ResolveAsync(
                (context) =>
            {
                var service = new ItemService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlItem, Item>()
            .Name("item")
            .Argument <NonNullGraphType <GuidGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <Guid>("id");

                var service = new ItemService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );

            this
            .Field <ListGraphType <GqlSkill>, List <Skill> >()
            .Name("skills")
            .ResolveAsync(
                (context) =>
            {
                var service = new SkillService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlSkill, Skill>()
            .Name("skill")
            .Argument <NonNullGraphType <GuidGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <Guid>("id");

                var service = new SkillService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );

            this
            .Field <ListGraphType <GqlVoiceActor>, List <VoiceActor> >()
            .Name("voiceActors")
            .ResolveAsync(
                (context) =>
            {
                var service = new VoiceActorService(dbContextFactory.CreateDbContext());

                return(service.GetAllAsync());
            }
                );

            this
            .Field <GqlVoiceActor, VoiceActor>()
            .Name("voiceActor")
            .Argument <NonNullGraphType <IntGraphType> >("id")
            .ResolveAsync(
                (context) =>
            {
                var id = context.GetArgument <int>("id");

                var service = new VoiceActorService(dbContextFactory.CreateDbContext());

                return(service.GetByIdAsync(id));
            }
                );
        }
Exemple #10
0
        public GqlHero(FehContextFactory dbContextFactory, IDataLoaderContextAccessor accessor)
        {
            this.Name = nameof(Hero);

            this.Field(nameof(Hero.AdditionDate), x => x.AdditionDate);
            this.Field(nameof(Hero.ArtistId), x => x.ArtistId);
            this.Field(nameof(Hero.AttackGrowthRate), x => x.AttackGrowthRate);
            this.Field(nameof(Hero.BaseAttack), x => x.BaseAttack);
            this.Field(nameof(Hero.BaseDefense), x => x.BaseDefense);
            this.Field(nameof(Hero.BaseHitPoints), x => x.BaseHitPoints);
            this.Field(nameof(Hero.BaseResistance), x => x.BaseResistance);
            this.Field(nameof(Hero.BaseSpeed), x => x.BaseSpeed);
            this.Field(nameof(Hero.BVID).ToLowerInvariant(), x => x.BVID);
            this.Field(nameof(Hero.Color), x => (int)x.Color);
            this.Field(nameof(Hero.CreatedAt), x => x.CreatedAt, type: typeof(DateTimeGraphType));
            this.Field(nameof(Hero.CreatedBy), x => x.CreatedBy);
            this.Field(nameof(Hero.DefenseGrowthRate), x => x.DefenseGrowthRate);
            this.Field(nameof(Hero.Description), x => x.Description);
            this.Field(nameof(Hero.Element), x => (int?)x.Element, nullable: true);
            this.Field(nameof(Hero.Gender), x => (int)x.Gender);
            this.Field(nameof(Hero.HitPointsGrowthRate), x => x.HitPointsGrowthRate);
            this.Field(nameof(Hero.Id), x => x.Id);
            this.Field(nameof(Hero.IsDuoHero), x => x.IsDuoHero);
            this.Field(nameof(Hero.IsLegendaryHero), x => x.IsLegendaryHero);
            this.Field(nameof(Hero.IsMythicHero), x => x.IsMythicHero);
            this.Field(nameof(Hero.IsResplendentHero), x => x.IsResplendentHero);
            this.Field(nameof(Hero.LegendaryHeroBoostType), x => (int?)x.LegendaryHeroBoostType, nullable: true);
            this.Field(nameof(Hero.ModifiedAt), x => x.ModifiedAt, type: typeof(DateTimeGraphType));
            this.Field(nameof(Hero.ModifiedBy), x => x.ModifiedBy);
            this.Field(nameof(Hero.MovementType), x => (int)x.MovementType);
            this.Field(nameof(Hero.MythicHeroBoostType), x => (int?)x.MythicHeroBoostType, nullable: true);
            this.Field(nameof(Hero.Name), x => x.Name);
            this.Field(nameof(Hero.Origin), x => x.Origin);
            this.Field(nameof(Hero.ReleaseDate), x => x.ReleaseDate);
            this.Field(nameof(Hero.ResistanceGrowthRate), x => x.ResistanceGrowthRate);
            this.Field(nameof(Hero.SpeedGrowthRate), x => x.SpeedGrowthRate);
            this.Field(nameof(Hero.Tag), x => x.Tag);
            this.Field(nameof(Hero.Title), x => x.Title);
            this.Field(nameof(Hero.Version), x => x.Version);
            this.Field(nameof(Hero.Weapon), x => (int)x.Weapon);

            /* Data Loader */

            this
            .Field <GqlArtist, Artist>()
            .Name(nameof(Hero.Artist))
            .ResolveAsync(
                (context) =>
            {
                var service = new ArtistService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddBatchLoader <int, Artist>(
                    $"{nameof(Artist)}_{nameof(ArtistService.GetByIdsAsync)}",
                    service.GetByIdsAsync
                    );

                return(loader.LoadAsync(context.Source.ArtistId));
            }
                );

            this
            .Field <ListGraphType <GqlHeroSkill>, IEnumerable <HeroSkill> >()
            .Name(nameof(Hero.HeroSkills))
            .ResolveAsync(
                (context) =>
            {
                var service = new HeroSkillService(dbContextFactory.CreateDbContext());

                var loader = accessor.Context.GetOrAddCollectionBatchLoader <Guid, HeroSkill>(
                    $"{nameof(HeroSkill)}_{nameof(HeroSkillService.GetByHeroIdsAsync)}",
                    service.GetByHeroIdsAsync
                    );

                return(loader.LoadAsync(context.Source.Id));
            }
                );

            this
            .Field <ListGraphType <GqlHeroVoiceActor>, IEnumerable <HeroVoiceActor> >()
            .Name(nameof(Hero.HeroVoiceActors))
            .Argument <NonNullGraphType <IntGraphType> >("language")
            .ResolveAsync(
                (context) =>
            {
                var service = new HeroVoiceActorService(dbContextFactory.CreateDbContext());

                var language = (Languages)context.GetArgument <int>("language");

                var loader = accessor.Context.GetOrAddCollectionBatchLoader(
                    $"{nameof(HeroVoiceActor)}_{nameof(HeroVoiceActorService.GetByHeroIdsAsync)}",
                    service.GetByHeroIdsAsync(language)
                    );

                return(loader.LoadAsync(context.Source.Id));
            }
                );
        }