Pull master

Louison
Louison PARANT 2 years ago
commit b909c87fca

@ -1,7 +1,10 @@
using Model;
using StubLib;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddSingleton<IDataManager, StubData>();
builder.Services.AddControllers(); builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();

@ -1,10 +1,11 @@
using Microsoft.EntityFrameworkCore; using EntityFrameworkLOL.Entities;
using Microsoft.EntityFrameworkCore;
namespace EntityFrameworkLOL namespace EntityFrameworkLOL.DBContexts
{ {
class ChampionContext : DbContext class ChampionContext : DbContext
{ {
public DbSet<ChampionEntity> Champions { get; set; } public DbSet<ChampionEntity> Champion { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db"); => options.UseSqlite($"Data Source=DBLOL.db");

@ -0,0 +1,13 @@
using EntityFrameworkLOL.Entities;
using Microsoft.EntityFrameworkCore;
namespace EntityFrameworkLOL.DBContexts
{
class RuneContext : DbContext
{
public DbSet<RuneEntity> Rune { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db");
}
}

@ -0,0 +1,15 @@
using EntityFrameworkLOL.Entities;
using Microsoft.EntityFrameworkCore;
namespace EntityFrameworkLOL.DBContexts
{
class SQLiteContext : DbContext
{
/*public DbSet<ChampionEntity> Champion { get; set; }
public DbSet<SkinEntity> Skin { get; set; }*/
public DbSet<RuneEntity> Rune { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db");
}
}

@ -0,0 +1,13 @@
using EntityFrameworkLOL.Entities;
using Microsoft.EntityFrameworkCore;
namespace EntityFrameworkLOL.DBContexts
{
class SkinContext : DbContext
{
public DbSet<SkinEntity> Skin { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source=DBLOL.db");
}
}

@ -5,8 +5,9 @@ using System.Threading.Tasks;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;
namespace EntityFrameworkLOL namespace EntityFrameworkLOL.Entities
{ {
class ChampionEntity class ChampionEntity
{ {

@ -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; }
}
}

@ -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; }*/
}
}

@ -21,4 +21,8 @@
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project> </Project>

@ -1,5 +1,5 @@
// <auto-generated /> // <auto-generated />
using EntityFrameworkLOL; using EntityFrameworkLOL.DBContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
@ -9,9 +9,9 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFrameworkLOL.Migrations namespace EntityFrameworkLOL.Migrations
{ {
[DbContext(typeof(ChampionContext))] [DbContext(typeof(SQLiteContext))]
[Migration("20230201163336_MigrationWallah")] [Migration("20230202105714_MigrationWallah2")]
partial class MigrationWallah partial class MigrationWallah2
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,22 +19,18 @@ namespace EntityFrameworkLOL.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EntityFrameworkLOL.ChampionEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{ {
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Bio") b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Name"); b.HasKey("Name");
b.ToTable("Champions"); b.ToTable("Rune");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

@ -5,22 +5,21 @@
namespace EntityFrameworkLOL.Migrations namespace EntityFrameworkLOL.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class MigrationWallah : Migration public partial class MigrationWallah2 : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Champions", name: "Rune",
columns: table => new columns: table => new
{ {
Name = table.Column<string>(type: "TEXT", nullable: false), Name = table.Column<string>(type: "TEXT", nullable: false),
Bio = table.Column<string>(type: "TEXT", nullable: false), Description = table.Column<string>(type: "TEXT", nullable: false)
Icon = table.Column<string>(type: "TEXT", nullable: false)
}, },
constraints: table => 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) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Champions"); name: "Rune");
} }
} }
} }

@ -1,5 +1,5 @@
// <auto-generated /> // <auto-generated />
using EntityFrameworkLOL; using EntityFrameworkLOL.DBContexts;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@ -8,30 +8,26 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFrameworkLOL.Migrations namespace EntityFrameworkLOL.Migrations
{ {
[DbContext(typeof(ChampionContext))] [DbContext(typeof(SQLiteContext))]
partial class ChampionContextModelSnapshot : ModelSnapshot partial class SQLiteContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); modelBuilder.HasAnnotation("ProductVersion", "7.0.2");
modelBuilder.Entity("EntityFrameworkLOL.ChampionEntity", b => modelBuilder.Entity("EntityFrameworkLOL.Entities.RuneEntity", b =>
{ {
b.Property<string>("Name") b.Property<string>("Name")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Bio") b.Property<string>("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Icon")
.IsRequired() .IsRequired()
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.HasKey("Name"); b.HasKey("Name");
b.ToTable("Champions"); b.ToTable("Rune");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }

@ -97,4 +97,3 @@ namespace StubLib
} }
} }
} }

Loading…
Cancel
Save