diff --git a/Sources/.dockerignore b/Sources/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/Sources/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/Sources/APILOL/APILOL.csproj b/Sources/APILOL/APILOL.csproj
index 2ac89b4..fa98d23 100644
--- a/Sources/APILOL/APILOL.csproj
+++ b/Sources/APILOL/APILOL.csproj
@@ -4,6 +4,8 @@
net6.0
enable
enable
+ 036530f1-7b72-4f69-a1a3-0b4039b6a80a
+ Linux
@@ -14,6 +16,7 @@
+
diff --git a/Sources/APILOL/Dockerfile b/Sources/APILOL/Dockerfile
new file mode 100644
index 0000000..767e4e8
--- /dev/null
+++ b/Sources/APILOL/Dockerfile
@@ -0,0 +1,26 @@
+#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
+WORKDIR /app
+EXPOSE 80
+EXPOSE 443
+
+FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
+WORKDIR /src
+COPY ["APILOL/APILOL.csproj", "APILOL/"]
+COPY ["DTO/DTO.csproj", "DTO/"]
+COPY ["Model/Model.csproj", "Model/"]
+COPY ["Shared/Shared.csproj", "Shared/"]
+COPY ["StubLib/StubLib.csproj", "StubLib/"]
+RUN dotnet restore "APILOL/APILOL.csproj"
+COPY . .
+WORKDIR "/src/APILOL"
+RUN dotnet build "APILOL.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "APILOL.csproj" -c Release -o /app/publish /p:UseAppHost=false
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "APILOL.dll"]
\ No newline at end of file
diff --git a/Sources/APILOL/Properties/launchSettings.json b/Sources/APILOL/Properties/launchSettings.json
index e001bda..c1b8f47 100644
--- a/Sources/APILOL/Properties/launchSettings.json
+++ b/Sources/APILOL/Properties/launchSettings.json
@@ -1,23 +1,14 @@
-{
- "$schema": "https://json.schemastore.org/launchsettings.json",
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:4308",
- "sslPort": 44305
- }
- },
+{
"profiles": {
"APILOL": {
"commandName": "Project",
- "dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
- "applicationUrl": "https://localhost:7015;http://localhost:5015",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
- }
+ },
+ "dotnetRunMessages": true,
+ "applicationUrl": "https://localhost:7015;http://localhost:5015"
},
"IIS Express": {
"commandName": "IISExpress",
@@ -26,6 +17,22 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
+ "publishAllPorts": true,
+ "useSSL": true
+ }
+ },
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:4308",
+ "sslPort": 44305
}
}
-}
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/ChampionContext.cs b/Sources/EntityFrameworkLOL/DBContexts/ChampionContext.cs
similarity index 52%
rename from Sources/EntityFrameworkLOL/ChampionContext.cs
rename to Sources/EntityFrameworkLOL/DBContexts/ChampionContext.cs
index 719926b..f7d3a11 100644
--- a/Sources/EntityFrameworkLOL/ChampionContext.cs
+++ b/Sources/EntityFrameworkLOL/DBContexts/ChampionContext.cs
@@ -1,10 +1,11 @@
-using Microsoft.EntityFrameworkCore;
+using EntityFrameworkLOL.Entities;
+using Microsoft.EntityFrameworkCore;
-namespace EntityFrameworkLOL
+namespace EntityFrameworkLOL.DBContexts
{
class ChampionContext : DbContext
{
- public DbSet Champions { get; set; }
+ public DbSet Champion { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db");
diff --git a/Sources/EntityFrameworkLOL/DBContexts/RuneContext.cs b/Sources/EntityFrameworkLOL/DBContexts/RuneContext.cs
new file mode 100644
index 0000000..daa69f9
--- /dev/null
+++ b/Sources/EntityFrameworkLOL/DBContexts/RuneContext.cs
@@ -0,0 +1,13 @@
+using EntityFrameworkLOL.Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace EntityFrameworkLOL.DBContexts
+{
+ class RuneContext : DbContext
+ {
+ public DbSet Rune { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ => options.UseSqlite($"Data Source=DBLOL.db");
+ }
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs
new file mode 100644
index 0000000..8c31903
--- /dev/null
+++ b/Sources/EntityFrameworkLOL/DBContexts/SQLiteContext.cs
@@ -0,0 +1,15 @@
+using EntityFrameworkLOL.Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace EntityFrameworkLOL.DBContexts
+{
+ class SQLiteContext : DbContext
+ {
+ /*public DbSet Champion { get; set; }
+ public DbSet Skin { get; set; }*/
+ public DbSet Rune { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ => options.UseSqlite($"Data Source=DBLOL.db");
+ }
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/DBContexts/SkinContext.cs b/Sources/EntityFrameworkLOL/DBContexts/SkinContext.cs
new file mode 100644
index 0000000..5628c53
--- /dev/null
+++ b/Sources/EntityFrameworkLOL/DBContexts/SkinContext.cs
@@ -0,0 +1,13 @@
+using EntityFrameworkLOL.Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace EntityFrameworkLOL.DBContexts
+{
+ class SkinContext : DbContext
+ {
+ public DbSet Skin { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder options)
+ => options.UseSqlite($"Data Source=DBLOL.db");
+ }
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/DBLOL.db b/Sources/EntityFrameworkLOL/DBLOL.db
index 6e8e7c5..e1ce9c7 100644
Binary files a/Sources/EntityFrameworkLOL/DBLOL.db and b/Sources/EntityFrameworkLOL/DBLOL.db differ
diff --git a/Sources/EntityFrameworkLOL/ChampionEntity.cs b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs
similarity index 85%
rename from Sources/EntityFrameworkLOL/ChampionEntity.cs
rename to Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs
index f693c37..fcc602e 100644
--- a/Sources/EntityFrameworkLOL/ChampionEntity.cs
+++ b/Sources/EntityFrameworkLOL/Entities/ChampionEntity.cs
@@ -5,8 +5,9 @@ using System.Threading.Tasks;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel.DataAnnotations;
+using System.Xml.Linq;
-namespace EntityFrameworkLOL
+namespace EntityFrameworkLOL.Entities
{
class ChampionEntity
{
diff --git a/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs b/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs
new file mode 100644
index 0000000..7ceb423
--- /dev/null
+++ b/Sources/EntityFrameworkLOL/Entities/RuneEntity.cs
@@ -0,0 +1,18 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+
+namespace EntityFrameworkLOL.Entities
+{
+ class RuneEntity
+ {
+ [Key]
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs b/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs
new file mode 100644
index 0000000..9412f33
--- /dev/null
+++ b/Sources/EntityFrameworkLOL/Entities/SkinEntity.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel.DataAnnotations;
+
+namespace EntityFrameworkLOL.Entities
+{
+ class SkinEntity
+ {
+ [Key]
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ /*public string Icon { get; set; }
+
+ public float Price { get; set; }*/
+ }
+}
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.DBLOL.db b/Sources/EntityFrameworkLOL/EntityFrameworkLOL.DBLOL.db
deleted file mode 100644
index e40710c..0000000
Binary files a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.DBLOL.db and /dev/null differ
diff --git a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj b/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj
index d683ca4..40baca6 100644
--- a/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj
+++ b/Sources/EntityFrameworkLOL/EntityFrameworkLOL.csproj
@@ -20,4 +20,8 @@
+
+
+
+
\ No newline at end of file
diff --git a/Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.Designer.cs b/Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.Designer.cs
similarity index 64%
rename from Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.Designer.cs
rename to Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.Designer.cs
index e24c7dc..da7a0e3 100644
--- a/Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.Designer.cs
+++ b/Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.Designer.cs
@@ -1,5 +1,5 @@
//
-using EntityFrameworkLOL;
+using EntityFrameworkLOL.DBContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
@@ -9,9 +9,9 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFrameworkLOL.Migrations
{
- [DbContext(typeof(ChampionContext))]
- [Migration("20230201163336_MigrationWallah")]
- partial class MigrationWallah
+ [DbContext(typeof(SQLiteContext))]
+ [Migration("20230202105714_MigrationWallah2")]
+ partial class MigrationWallah2
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -19,22 +19,18 @@ namespace EntityFrameworkLOL.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
- modelBuilder.Entity("EntityFrameworkLOL.ChampionEntity", b =>
+ modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{
b.Property("Name")
.HasColumnType("TEXT");
- b.Property("Bio")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Icon")
+ b.Property("Description")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Name");
- b.ToTable("Champions");
+ b.ToTable("Rune");
});
#pragma warning restore 612, 618
}
diff --git a/Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.cs b/Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.cs
similarity index 66%
rename from Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.cs
rename to Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.cs
index eb2dfc8..0150ec7 100644
--- a/Sources/EntityFrameworkLOL/Migrations/20230201163336_MigrationWallah.cs
+++ b/Sources/EntityFrameworkLOL/Migrations/20230202105714_MigrationWallah2.cs
@@ -5,22 +5,21 @@
namespace EntityFrameworkLOL.Migrations
{
///
- public partial class MigrationWallah : Migration
+ public partial class MigrationWallah2 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
- name: "Champions",
+ name: "Rune",
columns: table => new
{
Name = table.Column(type: "TEXT", nullable: false),
- Bio = table.Column(type: "TEXT", nullable: false),
- Icon = table.Column(type: "TEXT", nullable: false)
+ Description = table.Column(type: "TEXT", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_Champions", x => x.Name);
+ table.PrimaryKey("PK_Rune", x => x.Name);
});
}
@@ -28,7 +27,7 @@ namespace EntityFrameworkLOL.Migrations
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
- name: "Champions");
+ name: "Rune");
}
}
}
diff --git a/Sources/EntityFrameworkLOL/Migrations/ChampionContextModelSnapshot.cs b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs
similarity index 63%
rename from Sources/EntityFrameworkLOL/Migrations/ChampionContextModelSnapshot.cs
rename to Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs
index 351bf79..59fd766 100644
--- a/Sources/EntityFrameworkLOL/Migrations/ChampionContextModelSnapshot.cs
+++ b/Sources/EntityFrameworkLOL/Migrations/SQLiteContextModelSnapshot.cs
@@ -1,5 +1,5 @@
//
-using EntityFrameworkLOL;
+using EntityFrameworkLOL.DBContexts;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -8,30 +8,26 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFrameworkLOL.Migrations
{
- [DbContext(typeof(ChampionContext))]
- partial class ChampionContextModelSnapshot : ModelSnapshot
+ [DbContext(typeof(SQLiteContext))]
+ partial class SQLiteContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
- modelBuilder.Entity("EntityFrameworkLOL.ChampionEntity", b =>
+ modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{
b.Property("Name")
.HasColumnType("TEXT");
- b.Property("Bio")
- .IsRequired()
- .HasColumnType("TEXT");
-
- b.Property("Icon")
+ b.Property("Description")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Name");
- b.ToTable("Champions");
+ b.ToTable("Rune");
});
#pragma warning restore 612, 618
}
diff --git a/Sources/EntityFrameworkLOL/Program.cs b/Sources/EntityFrameworkLOL/Program.cs
index 3751555..7271191 100644
--- a/Sources/EntityFrameworkLOL/Program.cs
+++ b/Sources/EntityFrameworkLOL/Program.cs
@@ -1,2 +1,97 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
+using EntityFrameworkLOL.DBContexts;
+using EntityFrameworkLOL.Entities;
+using System.Linq;
+using System;
+using System.Text;
+
+class Program
+{
+ static void Main(string[] args)
+ {
+ /*ChampionEntity akali = new ChampionEntity {Name="Akali"};
+ ChampionEntity aatrox = new ChampionEntity { Name = "Aatrox" };
+ ChampionEntity ahri = new ChampionEntity { Name = "Ahri" };
+ ChampionEntity bard = new ChampionEntity { Name = "Bard" };
+ ChampionEntity alistar = new ChampionEntity { Name = "Alistar" };
+ ChampionEntity akshan = new ChampionEntity { Name = "Akshan" };
+
+ using (var context = new ChampionContext())
+ {
+ // Crée des champions et les insère dans la base
+ Console.WriteLine("Creates and inserts new Champions");
+ context.Add(akali);
+ context.Add(aatrox);
+ context.Add(ahri);
+ context.Add(bard);
+ context.Add(alistar);
+ context.Add(akshan);
+ context.SaveChanges();
+ Console.WriteLine("Creates and executes a query retrieving the first Champion of the database whose name starts with an \"A\":");
+ var aChampion = context.Champions
+ .Where(c => c.Name.StartsWith("A"))
+ .First();
+ Console.WriteLine($"{aChampion.Name} (with bio : {aChampion.Bio}");
+ }*/
+
+ RuneEntity conqueror = new RuneEntity { Name = "Conqueror", Description = "" };
+ RuneEntity thriumph = new RuneEntity { Name = "Thriumph", Description = "" };
+ RuneEntity alacrity = new RuneEntity { Name = "Legend : Alacrity", Description = "" };
+ RuneEntity tenacity = new RuneEntity { Name = "Legend : Tenacity", Description = "" };
+ RuneEntity laststand = new RuneEntity { Name = "Last Stand", Description = "" };
+ RuneEntity laststand2 = new RuneEntity { Name = "Last Stand 2", Description = "" };
+
+ using (var context = new RuneContext())
+ {
+ // Crée des Runes et les insère dans la base
+ Console.WriteLine("Creates and inserts new Runes");
+ context.Add(conqueror);
+ context.Add(thriumph);
+ context.Add(alacrity);
+ context.Add(tenacity);
+ context.Add(laststand);
+ context.Add(laststand2);
+ context.SaveChanges();
+ Console.WriteLine("Creates and executes a query retrieving the first Runes of the database whose name starts with an \"L\":");
+ var lRune = context.Rune
+ .Where(r => r.Name.StartsWith("L"))
+ .First();
+ Console.WriteLine($"{lRune.Name} (with Description : {lRune.Description}");
+ }
+
+ /*SkinEntity stinger = new SkinEntity { Name = "Stinger", Description = "" };
+ SkinEntity infernal = new SkinEntity { Name = "Infernal", Description = "" };
+ SkinEntity allStar = new SkinEntity { Name = "All-Star", Description = "" };
+ SkinEntity justicar = new SkinEntity { Name = "Justicar", Description = "" };
+ SkinEntity mecha = new SkinEntity { Name = "Mecha", Description = "" };
+ SkinEntity seaHunter = new SkinEntity { Name = "Sea Hunter", Description = "" };
+
+ using (var context = new SkinContext())
+ {
+ // Crée des Skins et les insère dans la base
+ Console.WriteLine("Creates and inserts new Skins");
+ context.Add(stinger);
+ context.Add(infernal);
+ context.Add(allStar);
+ context.Add(justicar);
+ context.Add(mecha);
+ context.Add(seaHunter);
+ context.SaveChanges();
+ Console.WriteLine("Creates and executes a query retrieving the first Skins of the database whose name starts with an \"I\":");
+ var iSkin = context.Skin
+ .Where(s => s.Name.StartsWith("I"))
+ .First();
+ Console.WriteLine($"{iSkin.Name} (with Description : {iSkin.Description}");
+
+ Console.WriteLine("Updates the name of the Infernal Skin");
+ iSkin.Name = "Infernal of Hell (Wallah)";
+ context.SaveChanges();
+ Console.WriteLine($"{iSkin.Name} (with Description : {iSkin.Description}");
+
+ Console.WriteLine("Deletes one item from the database");
+ var droid = context.Skin
+ .SingleOrDefault(s => s.Name.Equals("Infernal"));
+ context.Remove(droid);
+ context.SaveChanges();
+ }*/
+ }
+}
\ No newline at end of file
diff --git a/Sources/StubLib/StubData.Champions.cs b/Sources/StubLib/StubData.Champions.cs
index c7e93f3..6d99c73 100644
--- a/Sources/StubLib/StubData.Champions.cs
+++ b/Sources/StubLib/StubData.Champions.cs
@@ -102,5 +102,4 @@ namespace StubLib
=> parent.champions.UpdateItem(oldItem, newItem);
}
}
-}
-
+}
\ No newline at end of file