From 0384119f225b78d91e92696f803126a220ad5094 Mon Sep 17 00:00:00 2001 From: Emre Date: Sun, 19 Mar 2023 20:49:46 +0100 Subject: [PATCH] Added Mapper to Database :white_check_mark: --- .../Sources/ApiLol/Mapper/ChampionMapper.cs | 7 +-- .../Sources/ApiLol/Mapper/LargeImageMapper.cs | 13 +---- .../Sources/ApiLol/Mapper/RuneMapper.cs | 10 +--- .../Sources/ApiLol/Mapper/SkillMapper.cs | 10 +--- .../Sources/ApiLol/Mapper/SkinMapper.cs | 18 ++---- .../DbManager/Mapper/ChampionMapper.cs | 43 ++++++++++++++ .../DbManager/Mapper/LargeImageMapper.cs | 13 +++++ .../Sources/DbManager/Mapper/RuneMapper.cs | 21 +++++++ .../DbManager/Mapper/RunePageMapper.cs | 24 ++++++++ .../Sources/DbManager/Mapper/SkillMapper.cs | 24 ++++++++ .../Sources/DbManager/Mapper/SkinMapper.cs | 22 +++++++ .../DbManager/Mapper/enums/CategoryMapper.cs | 50 ++++++++++++++++ .../Mapper/enums/ChampionClassMapper.cs | 55 ++++++++++++++++++ .../Mapper/enums/RuneFamilyMapper.cs | 43 ++++++++++++++ .../DbManager/Mapper/enums/SkillTypeMapper.cs | 42 +++++++++++++ .../Sources/MyFlib/DataBase.db | Bin 131072 -> 131072 bytes .../Sources/MyFlib/DataSeeder.cs | 4 +- .../Sources/MyFlib/Entities/RuneEntity.cs | 1 + .../Sources/MyFlib/LolDbContext.cs | 4 +- .../Sources/Tests/UT_EF/RunesTest.cs | 24 ++++---- 20 files changed, 370 insertions(+), 58 deletions(-) create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/ChampionMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/LargeImageMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/RunePageMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/SkillMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/SkinMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/CategoryMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/ChampionClassMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/RuneFamilyMapper.cs create mode 100644 src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/SkillTypeMapper.cs diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/ChampionMapper.cs b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/ChampionMapper.cs index 094739d..7450581 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/ChampionMapper.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/ChampionMapper.cs @@ -6,8 +6,7 @@ namespace ApiLol.Mapper public static class ChampionMapper { public static ChampionDto ToDto(this Champion champion) - { - return new ChampionDto() + => new() { Name = champion.Name, Bio = champion.Bio, @@ -17,12 +16,12 @@ namespace ApiLol.Mapper Skins = champion.Skins.Select(e => e.ToDto()), Skills = champion.Skills.Select(e => e.ToDto()) }; - } + public static Champion ToModel(this ChampionDto championDto) { var champ = new Champion(championDto.Name, championDto.Class.ToModel(), championDto.Icon, championDto.Image.Base64, championDto.Bio); - foreach(var skin in championDto.Skins) + foreach (var skin in championDto.Skins) { champ.AddSkin(skin.ToModel(champ)); } diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/LargeImageMapper.cs b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/LargeImageMapper.cs index 6bebb6f..a0b8756 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/LargeImageMapper.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/LargeImageMapper.cs @@ -6,16 +6,9 @@ namespace ApiLol.Mapper public static class LargeImageMapper { public static LargeImageDto ToDto(this LargeImage largeImage) - { - return new LargeImageDto() - { - Base64 = largeImage.Base64 - }; - } + => new() { Base64 = largeImage.Base64 }; + + public static LargeImage ToModel(this LargeImageDto largeImageDto) => new(largeImageDto.Base64); - public static LargeImage ToModel(this LargeImageDto largeImageDto) - { - return new LargeImage(largeImageDto.Base64); - } } } \ No newline at end of file diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/RuneMapper.cs b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/RuneMapper.cs index af4640e..b11f1aa 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/RuneMapper.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/RuneMapper.cs @@ -7,8 +7,7 @@ namespace ApiLol.Mapper public static class RuneMapper { public static RuneDto ToDto(this Rune rune) - { - return new RuneDto() + => new() { Name = rune.Name, Description = rune.Description, @@ -16,11 +15,8 @@ namespace ApiLol.Mapper Icon = rune.Icon, Image = rune.Image.ToDto() }; - } - public static Rune ToModel(this RuneDto rune) - { - return new Rune(rune.Name, rune.Family.ToModel(), rune.Icon, rune.Image.Base64, rune.Description); - } + public static Rune ToModel(this RuneDto rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, rune.Image.Base64, rune.Description); + } } diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkillMapper.cs b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkillMapper.cs index 20c0787..27bb55b 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkillMapper.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkillMapper.cs @@ -6,18 +6,14 @@ namespace ApiLol.Mapper public static class SkillMapper { public static SkillDto ToDto(this Skill skill) - { - return new SkillDto() + => new() { Name = skill.Name, Description = skill.Description, Type = skill.Type.ToDto() }; - } - public static Skill ToModel(this SkillDto skillDto) - { - return new Skill(skillDto.Name, skillDto.Type.ToModel(), skillDto.Description); - } + public static Skill ToModel(this SkillDto skillDto) => new(skillDto.Name, skillDto.Type.ToModel(), skillDto.Description); + } } diff --git a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkinMapper.cs b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkinMapper.cs index 776209e..d4d7221 100644 --- a/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkinMapper.cs +++ b/src/EntityFramework_LoL/Sources/ApiLol/Mapper/SkinMapper.cs @@ -6,8 +6,7 @@ namespace ApiLol.Mapper public static class SkinMapper { public static SkinDto ToDto(this Skin skin) - { - return new SkinDto() + => new() { Name = skin.Name, Description = skin.Description, @@ -15,11 +14,9 @@ namespace ApiLol.Mapper Image = skin.Image.ToDto(), Price = skin.Price }; - } public static SkinDtoC ToDtoC(this Skin skin) - { - return new SkinDtoC() + => new() { Name = skin.Name, Description = skin.Description, @@ -28,17 +25,10 @@ namespace ApiLol.Mapper Price = skin.Price, ChampionName = skin.Champion.Name }; - } - public static Skin ToModel(this SkinDto skinDto, Champion champ) - { - return new Skin(skinDto.Name, champ, skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description); - } + public static Skin ToModel(this SkinDto skinDto, Champion champ) => new(skinDto.Name, champ, skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description); - public static Skin ToModelC(this SkinDtoC skinDto, Champion champ) - { - return new Skin(skinDto.Name, champ, skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description); - } + public static Skin ToModelC(this SkinDtoC skinDto, Champion champ) => new(skinDto.Name, champ, skinDto.Price, skinDto.Icon, skinDto.Image.Base64, skinDto.Description); } } \ No newline at end of file diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/ChampionMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/ChampionMapper.cs new file mode 100644 index 0000000..454bc54 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/ChampionMapper.cs @@ -0,0 +1,43 @@ +using DbManager.Mapper.enums; +using Model; +using MyFlib; + +namespace DbManager.Mapper +{ + public static class ChampionMapper + { + public static Champion ToModel(this ChampionEntity championEntity) + { + Champion champion = new (championEntity.Name, championEntity.Class.ToModel(), championEntity.Icon, championEntity.Image.Base64.ToString(), championEntity.Bio); + foreach (var skill in championEntity.Skills) + { + champion.AddSkill(skill.ToModel()); + } + foreach (var skin in championEntity.Skins) + { + champion.AddSkin(skin.ToModel()); + } + return champion; + } + + public static ChampionEntity ToEntity(this Champion champion, LolDbContext context) + { + var champ = new ChampionEntity() + { + Name = champion.Name, + Icon = champion.Icon, + Bio = champion.Bio, + Image = champion.Image.ToEntity(), + }; + foreach (var skill in champion.Skills) + { + champ.Skills.Add(skill.ToEntity(champ)); + } + foreach (var skin in champion.Skins) + { + champ.Skins.Add(skin.ToEntity(context)); + } + return champ; + } + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/LargeImageMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/LargeImageMapper.cs new file mode 100644 index 0000000..594c0b6 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/LargeImageMapper.cs @@ -0,0 +1,13 @@ +using Model; +using MyFlib; + +namespace DbManager.Mapper +{ + public static class LargeImageMapper + { + public static LargeImage ToModel(this LargeImageEntity largeImage) => new(largeImage.Base64); + + public static LargeImageEntity ToEntity(this LargeImage largeImage) => new() { Base64 = largeImage.Base64 }; + + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs new file mode 100644 index 0000000..788ce1e --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RuneMapper.cs @@ -0,0 +1,21 @@ +using DbManager.Mapper.enums; +using Model; +using MyFlib; + +namespace DbManager.Mapper +{ + public static class RuneMapper + { + public static Rune ToModel(this RuneEntity rune) => new(rune.Name, rune.Family.ToModel(), rune.Icon, rune.Image.Base64, rune.Description); + public static RuneEntity ToEntity(this Rune rune) + => new() + { + Name = rune.Name, + Description = rune.Description, + Family = rune.Family.ToEntity(), + Icon = rune.Icon, + Image = rune.Image.ToEntity() + }; + + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/RunePageMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RunePageMapper.cs new file mode 100644 index 0000000..839ba0e --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/RunePageMapper.cs @@ -0,0 +1,24 @@ +using DbManager.Mapper.enums; +using Model; +using MyFlib; +using MyFlib.Entities; + +namespace DbManager.Mapper +{ + public static class RunePageMapper + { + public static RunePage ToModel(this RunePageEntity runePageEntity, LolDbContext context) + { + RunePage runePage = new(runePageEntity.Name); + foreach (var d in runePageEntity.DictionaryCategoryRunes) + { + var rune = context.Runes.Find(d.RuneName); + if (rune!=null) + { + runePage[d.category.ToModel()] = rune.ToModel(); + } + } + return runePage; + } + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkillMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkillMapper.cs new file mode 100644 index 0000000..9e8b636 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkillMapper.cs @@ -0,0 +1,24 @@ +using DbManager.Mapper.enums; +using Model; +using MyFlib; + +namespace DbManager.Mapper +{ + public static class SkillMapper + { + public static Skill ToModel(this SkillEntity skillEntity) => new(skillEntity.Name, skillEntity.Type.ToModel(), skillEntity.Description); + + + public static SkillEntity ToEntity(this Skill skill, ChampionEntity championEntity) + { + return new() + { + Name = skill.Name, + Description = skill.Description, + Type = skill.Type.ToEntity(), + Champion = championEntity + }; + } + + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkinMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkinMapper.cs new file mode 100644 index 0000000..391891f --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/SkinMapper.cs @@ -0,0 +1,22 @@ +using Model; +using MyFlib; + +namespace DbManager.Mapper +{ + public static class SkinMapper + { + public static Skin ToModel(this SkinEntity skinEntity) + => new(skinEntity.Name, skinEntity.Champion.ToModel(), skinEntity.Price, skinEntity.Icon, skinEntity.Image.Base64, skinEntity.Description); + + public static SkinEntity ToEntity(this Skin skin, LolDbContext context) + => new() + { + Name = skin.Name, + Description = skin.Description, + Icon = skin.Icon, + Price = skin.Price, + Champion = context.Champions.Find(skin.Champion.Name), + Image = skin.Image.ToEntity() + }; + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/CategoryMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/CategoryMapper.cs new file mode 100644 index 0000000..6b4c872 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/CategoryMapper.cs @@ -0,0 +1,50 @@ +using Model; +using MyFlib.Entities.enums; + +namespace DbManager.Mapper.enums +{ + public static class CategoryMapper + { + public static RunePage.Category ToModel(this CategoryEntity category) + { + switch (category) + { + case CategoryEntity.Major: + return RunePage.Category.Major; + case CategoryEntity.Minor1: + return RunePage.Category.Minor1; + case CategoryEntity.Minor2: + return RunePage.Category.Minor2; + case CategoryEntity.Minor3: + return RunePage.Category.Minor3; + case CategoryEntity.OtherMinor1: + return RunePage.Category.OtherMinor1; + case CategoryEntity.OtherMinor2: + return RunePage.Category.OtherMinor2; + default: + return RunePage.Category.Major; + } + } + + public static CategoryEntity ToEntity(this RunePage.Category category) + { + switch (category) + { + case RunePage.Category.Major: + return CategoryEntity.Major; + case RunePage.Category.Minor1: + return CategoryEntity.Minor1; + case RunePage.Category.Minor2: + return CategoryEntity.Minor2; + case RunePage.Category.Minor3: + return CategoryEntity.Minor3; + case RunePage.Category.OtherMinor1: + return CategoryEntity.OtherMinor1; + case RunePage.Category.OtherMinor2: + return CategoryEntity.OtherMinor2; + default: + return CategoryEntity.Major; + } + } + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/ChampionClassMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/ChampionClassMapper.cs new file mode 100644 index 0000000..a1948a8 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/ChampionClassMapper.cs @@ -0,0 +1,55 @@ +using Model; +using MyFlib; + +namespace DbManager.Mapper.enums +{ + public static class ChampionClassMapper + { + public static ChampionClass ToModel(this ChampionClassEntity championClass) + { + switch (championClass) + { + case ChampionClassEntity.Unknown: + return ChampionClass.Unknown; + case ChampionClassEntity.Assassin: + return ChampionClass.Assassin; + case ChampionClassEntity.Fighter: + return ChampionClass.Fighter; + case ChampionClassEntity.Mage: + return ChampionClass.Mage; + case ChampionClassEntity.Marksman: + return ChampionClass.Marksman; + case ChampionClassEntity.Support: + return ChampionClass.Support; + case ChampionClassEntity.Tank: + return ChampionClass.Tank; + default: + return ChampionClass.Unknown; + } + } + + public static ChampionClassEntity ToEntity(this ChampionClass championClass) + { + switch (championClass) + { + case ChampionClass.Unknown: + return ChampionClassEntity.Unknown; + case ChampionClass.Assassin: + return ChampionClassEntity.Assassin; + case ChampionClass.Fighter: + return ChampionClassEntity.Fighter; + case ChampionClass.Mage: + return ChampionClassEntity.Mage; + case ChampionClass.Marksman: + return ChampionClassEntity.Marksman; + case ChampionClass.Support: + return ChampionClassEntity.Support; + case ChampionClass.Tank: + return ChampionClassEntity.Tank; + default: + return ChampionClassEntity.Unknown; + } + } + + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/RuneFamilyMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/RuneFamilyMapper.cs new file mode 100644 index 0000000..c593f34 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/RuneFamilyMapper.cs @@ -0,0 +1,43 @@ +using Model; +using MyFlib.Entities.enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DbManager.Mapper.enums +{ + public static class RuneFamilyMapper + { + public static RuneFamily ToModel(this RuneFamilyEntity runeFamily) + { + switch (runeFamily) + { + case RuneFamilyEntity.Unknown: + return RuneFamily.Unknown; + case RuneFamilyEntity.Precision: + return RuneFamily.Precision; + case RuneFamilyEntity.Domination: + return RuneFamily.Domination; + default: + return RuneFamily.Unknown; + } + } + + public static RuneFamilyEntity ToEntity(this RuneFamily runeFamily) + { + switch (runeFamily) + { + case RuneFamily.Unknown: + return RuneFamilyEntity.Unknown; + case RuneFamily.Precision: + return RuneFamilyEntity.Precision; + case RuneFamily.Domination: + return RuneFamilyEntity.Domination; + default: + return RuneFamilyEntity.Unknown; + } + } + } +} diff --git a/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/SkillTypeMapper.cs b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/SkillTypeMapper.cs new file mode 100644 index 0000000..f3969e6 --- /dev/null +++ b/src/EntityFramework_LoL/Sources/DbManager/Mapper/enums/SkillTypeMapper.cs @@ -0,0 +1,42 @@ +using Model; +using MyFlib; + +namespace DbManager.Mapper.enums +{ + public static class SkillTypeMapper + { + public static SkillType ToModel(this SkillTypeEntity skillTypeEntity) + { + switch (skillTypeEntity) + { + case SkillTypeEntity.Unknown: + return SkillType.Unknown; + case SkillTypeEntity.Basic: + return SkillType.Basic; + case SkillTypeEntity.Passive: + return SkillType.Passive; + case SkillTypeEntity.Ultimate: + return SkillType.Ultimate; + default: + return SkillType.Unknown; + } + } + public static SkillTypeEntity ToEntity(this SkillType skillType) + { + switch (skillType) + { + case SkillType.Unknown: + return SkillTypeEntity.Unknown; + case SkillType.Basic: + return SkillTypeEntity.Basic; + case SkillType.Passive: + return SkillTypeEntity.Passive; + case SkillType.Ultimate: + return SkillTypeEntity.Ultimate; + default: + return SkillTypeEntity.Unknown; + } + + } + } +} diff --git a/src/EntityFramework_LoL/Sources/MyFlib/DataBase.db b/src/EntityFramework_LoL/Sources/MyFlib/DataBase.db index 59a1e3911cadba4db5b050e974c66d7b91eca2ac..298aaffcf9e9caf01d19b8793fc24b632bddd1ac 100644 GIT binary patch delta 4048 zcma)9U2qfE71q`6Y9*}QwG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uDPgA_Oy~j3;Y@qgSMm<`S#j1Rf+_Qa3Xc9Pj+ z)3W0{R}(c=eVMQ+R&882P8yHs%Xn%@_w80`ZMv>QEkC3|fs;3R1x%F%k`CA~t7mty z09yWP2uHl>5)|;wpF)vcH*QhFQ_KV&TxL5ngHy1GJ zExuNzTK!gfTgiiN=@@K>?Vj_idM)KA+F;b)Wrk%m`bLOW%J8-Frb8$Zp`lG4DGk@J zwWE%clIaF1h(vh|idGeJ3KY|bdrotI7d!~M`&bv?gJ4EaHt!TlxG)M8VdKa{I{gp% zyr*abN`Ugp9>@V7M?V>Edk-7|#edjGt-plBJ9=S@;!Q*-6>|9kR5#v-cG>+zlP(e? zs4r+OTBX0(_lKIU#FT7#Le6t@<8W4z_e53e<|6ElP;0dadvmGfVi9(Ld?1WuXc+d( zY)XpTZz;R&H`P=-qBbDmam52di1)q-4|@o)e^a+f8Th}I7DBqyNEg6vmx>|nMh92{ zPGe94L3>gPua_Uc*a`P3=0Gro{;lXlEo^wdegoHHgb^5pq$9Erf*0M&LS!Pakr6+_ zhsZ&g2-GSO{;qUlJ z;$##dA_?gkUY9df4SB#_{>$Py_u@{6Fyjjx&QzG diff --git a/src/EntityFramework_LoL/Sources/MyFlib/DataSeeder.cs b/src/EntityFramework_LoL/Sources/MyFlib/DataSeeder.cs index 12b19ca..b3ba905 100644 --- a/src/EntityFramework_LoL/Sources/MyFlib/DataSeeder.cs +++ b/src/EntityFramework_LoL/Sources/MyFlib/DataSeeder.cs @@ -29,8 +29,8 @@ namespace MyFlib context.AddRange(yasuoTempest, LuxFinal); // Runes - RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; context.AddRange(conqueror, ravenousHunter); diff --git a/src/EntityFramework_LoL/Sources/MyFlib/Entities/RuneEntity.cs b/src/EntityFramework_LoL/Sources/MyFlib/Entities/RuneEntity.cs index 5e4c249..9c6683f 100644 --- a/src/EntityFramework_LoL/Sources/MyFlib/Entities/RuneEntity.cs +++ b/src/EntityFramework_LoL/Sources/MyFlib/Entities/RuneEntity.cs @@ -16,6 +16,7 @@ namespace MyFlib [Required] public RuneFamilyEntity Family { get; set; } public ICollection DictionaryCategoryRunes { get; set; } + public string Icon { get; set; } public LargeImageEntity Image { get; set; } [ForeignKey("Image")] diff --git a/src/EntityFramework_LoL/Sources/MyFlib/LolDbContext.cs b/src/EntityFramework_LoL/Sources/MyFlib/LolDbContext.cs index 971d018..e680eb9 100644 --- a/src/EntityFramework_LoL/Sources/MyFlib/LolDbContext.cs +++ b/src/EntityFramework_LoL/Sources/MyFlib/LolDbContext.cs @@ -73,8 +73,8 @@ namespace MyFlib ); //RuneEntity - RuneEntity runeHextech = new RuneEntity { Name = "Hextech Flashtraption ", Description = "While Flash is on cooldown, it is replaced by Hexflash.", Family = RuneFamilyEntity.Unknown, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity runeManaflow = new RuneEntity { Name = "Manaflow Band ", Description = "Hitting enemy champions with a spell grants 25 maximum mana, up to 250 mana.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{9f9086f5-5cc5-47b5-af9b-a935f4e9b89c}") }; + RuneEntity runeHextech = new RuneEntity { Name = "Hextech Flashtraption ", Description = "While Flash is on cooldown, it is replaced by Hexflash.", Family = RuneFamilyEntity.Unknown, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity runeManaflow = new RuneEntity { Name = "Manaflow Band ", Description = "Hitting enemy champions with a spell grants 25 maximum mana, up to 250 mana.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{9f9086f5-5cc5-47b5-af9b-a935f4e9b89c}") }; modelBuilder.Entity().HasData(runeHextech, runeManaflow); //RunePageEntity diff --git a/src/EntityFramework_LoL/Sources/Tests/UT_EF/RunesTest.cs b/src/EntityFramework_LoL/Sources/Tests/UT_EF/RunesTest.cs index 6b004d5..4620f30 100644 --- a/src/EntityFramework_LoL/Sources/Tests/UT_EF/RunesTest.cs +++ b/src/EntityFramework_LoL/Sources/Tests/UT_EF/RunesTest.cs @@ -20,10 +20,10 @@ namespace UT_EF using (var context = new LolDbContext(options)) { - RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; - RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; + RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; + RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, Icon = "", ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; context.Runes.AddRange(conqueror, ravenousHunter, electrocute, pressTheAttack); context.SaveChanges(); @@ -45,10 +45,10 @@ namespace UT_EF using (var context = new LolDbContext(options)) { - RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; - RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; + RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; + RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, Icon = "", ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; context.Runes.AddRange(conqueror, ravenousHunter, electrocute, pressTheAttack); context.SaveChanges(); @@ -88,10 +88,10 @@ namespace UT_EF using (var context = new LolDbContext(options)) { - RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; - RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; - RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; + RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "by dealing damage to an enemy champion, you accumulate stacks that, once fully stacked, increase your damage and provide you with healing.", Family = RuneFamilyEntity.Unknown, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity ravenousHunter = new RuneEntity { Name = "Ravenous Hunter", Description = "killing minions, monsters, or enemy champions grants you stacks of Ravenous Hunter, which increase your damage against enemy champions and provide you with healing.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{8d121cdc-6787-4738-8edd-9e026ac16b65}") }; + RuneEntity electrocute = new RuneEntity { Name = "Electrocute", Description = "hitting an enemy champion with 3 separate attacks or abilities within 3 seconds deals bonus damage.", Family = RuneFamilyEntity.Domination, Icon = "", ImageId = Guid.Parse("{e7c87f12-2c7b-44d5-8867-eba1ae5a4657}") }; + RuneEntity pressTheAttack = new RuneEntity { Name = "Press the Attack", Description = "hitting an enemy champion with 3 consecutive basic attacks deals bonus damage and makes them take increased damage from all sources for a short period of time.", Family = RuneFamilyEntity.Precision, Icon = "", ImageId = Guid.Parse("{7c354729-5ecf-43d8-ae73-153740e87644}") }; context.Runes.AddRange(conqueror, ravenousHunter, electrocute, pressTheAttack); context.SaveChanges();