avancement
continuous-integration/drone/push Build is failing Details

master
Jolys Enzo 2 years ago
parent eb4fb9c92f
commit f162af1a0a

@ -17,6 +17,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\DTO\DTO.csproj" /> <ProjectReference Include="..\DTO\DTO.csproj" />
<ProjectReference Include="..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\StubLib\StubLib.csproj" /> <ProjectReference Include="..\StubLib\StubLib.csproj" />
</ItemGroup> </ItemGroup>

@ -110,11 +110,18 @@ namespace Api_lol.Controllers
return Ok(champion.ModelToDto()); return Ok(champion.ModelToDto());
} }
/* [HttpGet]
public IActionResult GetVersion2() [Route("/GetItems")]
public async Task<IEnumerable<Champion?>> GetItems(int index,int count,string? propertyName = null, bool descending = false)
{
return await data.ChampionsMgr.GetItems(index, count, propertyName, descending);
}
[HttpGet]
[Route("/GetNbItems")]
public async Task<int> GetNbItems()
{ {
return Ok("La version 2.0 est en cours de construction. PS : j'ai plusieur version !!"); return await data.ChampionsMgr.GetNbItems();
} }
*/
} }
} }

@ -1,3 +1,4 @@
using EntityFramwork.Manager;
using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.AspNetCore.Mvc.Versioning;
using Model; using Model;
using StubLib; using StubLib;
@ -11,9 +12,9 @@ builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer(); builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen();
builder.Services.AddSingleton<IDataManager, StubData>(); builder.Services.AddSingleton<IDataManager,Manager>();
builder.Services.AddApiVersioning(o => o.ApiVersionReader = new UrlSegmentApiVersionReader()); //builder.Services.AddApiVersioning(o => o.ApiVersionReader = new UrlSegmentApiVersionReader());
var app = builder.Build(); var app = builder.Build();

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,14 @@
// See https://aka.ms/new-console-template for more information
using EntityFramwork.Manager;
using Model;
Console.WriteLine("Start !");
Manager manager = new Manager();
//IEnumerable<Champion?> tmp = await manager.ChampionsMgr.GetItems(2, 4);
Console.WriteLine(await manager.ChampionsMgr.GetNbItems());
Console.WriteLine("End !");

@ -181,7 +181,8 @@ namespace EntityFramwork
{ {
if (!optionsBuilder.IsConfigured) if (!optionsBuilder.IsConfigured)
{ {
optionsBuilder.UseSqlite($"Data Source=BDD-APILOL.db"); //optionsBuilder.UseSqlite($"Data Source=BDD-APILOL.db");
optionsBuilder.UseSqlite($"Data Source=C:\\Users\\Jolys Enzo\\home\\BUT\\Projet\\TMP\\Api-LOL\\Sources\\EntityFramwork\\BDD-APILOL.db");
} }
} }
} }

@ -52,9 +52,6 @@ namespace EntityFramwork.Factories
return new Champion(entity.Name,champClass:classe,icon:entity.Icon,bio:entity.Bio); return new Champion(entity.Name,champClass:classe,icon:entity.Icon,bio:entity.Bio);
} }
public
// Skins // Skins
public static EntitySkins SkinsModelToEntity(this Skin skin,int id) public static EntitySkins SkinsModelToEntity(this Skin skin,int id)
{ {

@ -50,14 +50,14 @@ namespace EntityFramwork.Manager
{ {
if ( descending == false) if ( descending == false)
{ {
items = db.Champions.Skip(index).Take(count).OrderBy(e => e.Name).Select(e => e.EntityChampionToModele()); items = db.Champions.Skip(index).Take(count).OrderBy(e => e.Name).Select(e => e.EntityChampionToModele()).ToList();
} }
else else
{ {
items = db.Champions.Skip(index).Take(count).OrderByDescending(e => e.Name).Select(e => e.EntityChampionToModele()); items = db.Champions.Skip(index).Take(count).OrderByDescending(e => e.Name).Select(e => e.EntityChampionToModele()).ToList();
} }
} }
return Task.FromResult<IEnumerable<Champion?>>(items); return Task.FromResult(items);
} }
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false) public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
@ -92,7 +92,13 @@ namespace EntityFramwork.Manager
public Task<int> GetNbItems() public Task<int> GetNbItems()
{ {
throw new NotImplementedException(); int nb = 0;
using (BDDContext db = new BDDContext())
{
nb = db.Champions.Count();
}
return Task.FromResult(nb);
} }
public Task<int> GetNbItemsByCharacteristic(string charName) public Task<int> GetNbItemsByCharacteristic(string charName)

@ -10,8 +10,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace EntityFramwork.Migrations namespace EntityFramwork.Migrations
{ {
[DbContext(typeof(BDDContext))] [DbContext(typeof(BDDContext))]
[Migration("20230301140337_tp")] [Migration("20230321151711_test")]
partial class tp partial class test
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -19,7 +19,55 @@ namespace EntityFramwork.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("DTO.EntityChampions", b => modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -111,54 +159,6 @@ namespace EntityFramwork.Migrations
}); });
}); });
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b => modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -598,17 +598,6 @@ namespace EntityFramwork.Migrations
}); });
}); });
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b => modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{ {
b.HasOne("EntityFramwork.EntityPageRune", "PageRune") b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
@ -628,6 +617,17 @@ namespace EntityFramwork.Migrations
b.Navigation("Rune"); b.Navigation("Rune");
}); });
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("EntityFramwork.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b => modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{ {
b.HasOne("EntityFramwork.EntityLargeImage", "Image") b.HasOne("EntityFramwork.EntityLargeImage", "Image")
@ -641,7 +641,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkill", b => modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{ {
b.HasOne("DTO.EntityChampions", "Champions") b.HasOne("EntityFramwork.EntityChampions", "Champions")
.WithMany("Skills") .WithMany("Skills")
.HasForeignKey("ChampionId") .HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -652,7 +652,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkins", b => modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{ {
b.HasOne("DTO.EntityChampions", "Champion") b.HasOne("EntityFramwork.EntityChampions", "Champion")
.WithMany("Skins") .WithMany("Skins")
.HasForeignKey("ChampionId") .HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -669,7 +669,7 @@ namespace EntityFramwork.Migrations
b.Navigation("Image"); b.Navigation("Image");
}); });
modelBuilder.Entity("DTO.EntityChampions", b => modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{ {
b.Navigation("Skills"); b.Navigation("Skills");

@ -7,7 +7,7 @@
namespace EntityFramwork.Migrations namespace EntityFramwork.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class tp : Migration public partial class test : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)

@ -16,7 +16,55 @@ namespace EntityFramwork.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("DTO.EntityChampions", b => modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
@ -108,54 +156,6 @@ namespace EntityFramwork.Migrations
}); });
}); });
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Category")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("IdPageRune")
.HasColumnType("INTEGER");
b.Property<int>("IdRune")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("IdPageRune");
b.HasIndex("IdRune");
b.ToTable("CategorieRunes");
b.HasData(
new
{
Id = 1,
Category = "Major",
IdPageRune = 1,
IdRune = 1
},
new
{
Id = 2,
Category = "Minor",
IdPageRune = 2,
IdRune = 2
},
new
{
Id = 3,
Category = "Other",
IdPageRune = 3,
IdRune = 3
});
});
modelBuilder.Entity("EntityFramwork.EntityLargeImage", b => modelBuilder.Entity("EntityFramwork.EntityLargeImage", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")
@ -595,17 +595,6 @@ namespace EntityFramwork.Migrations
}); });
}); });
modelBuilder.Entity("DTO.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("DTO.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b => modelBuilder.Entity("EntityFramwork.EntityCategorieRune", b =>
{ {
b.HasOne("EntityFramwork.EntityPageRune", "PageRune") b.HasOne("EntityFramwork.EntityPageRune", "PageRune")
@ -625,6 +614,17 @@ namespace EntityFramwork.Migrations
b.Navigation("Rune"); b.Navigation("Rune");
}); });
modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{
b.HasOne("EntityFramwork.EntityLargeImage", "Image")
.WithOne("Champion")
.HasForeignKey("EntityFramwork.EntityChampions", "ImageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Image");
});
modelBuilder.Entity("EntityFramwork.EntityRunes", b => modelBuilder.Entity("EntityFramwork.EntityRunes", b =>
{ {
b.HasOne("EntityFramwork.EntityLargeImage", "Image") b.HasOne("EntityFramwork.EntityLargeImage", "Image")
@ -638,7 +638,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkill", b => modelBuilder.Entity("EntityFramwork.EntitySkill", b =>
{ {
b.HasOne("DTO.EntityChampions", "Champions") b.HasOne("EntityFramwork.EntityChampions", "Champions")
.WithMany("Skills") .WithMany("Skills")
.HasForeignKey("ChampionId") .HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -649,7 +649,7 @@ namespace EntityFramwork.Migrations
modelBuilder.Entity("EntityFramwork.EntitySkins", b => modelBuilder.Entity("EntityFramwork.EntitySkins", b =>
{ {
b.HasOne("DTO.EntityChampions", "Champion") b.HasOne("EntityFramwork.EntityChampions", "Champion")
.WithMany("Skins") .WithMany("Skins")
.HasForeignKey("ChampionId") .HasForeignKey("ChampionId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
@ -666,7 +666,7 @@ namespace EntityFramwork.Migrations
b.Navigation("Image"); b.Navigation("Image");
}); });
modelBuilder.Entity("DTO.EntityChampions", b => modelBuilder.Entity("EntityFramwork.EntityChampions", b =>
{ {
b.Navigation("Skills"); b.Navigation("Skills");

@ -35,7 +35,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ViewModels", "..\SourcesMob
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "..\SourcesMobileApp\Model\Model.csproj", "{59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "..\SourcesMobileApp\Model\Model.csproj", "{59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RelationApi", "RelationApi\RelationApi.csproj", "{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RelationApi", "RelationApi\RelationApi.csproj", "{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Console", "Console\Console.csproj", "{D00C8129-D2BC-4710-BDC0-FAAA640B0871}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -101,6 +103,10 @@ Global
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU {C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU {C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.Build.0 = Release|Any CPU {C9ED623A-9298-4644-BA5C-36BBFBC52CFF}.Release|Any CPU.Build.0 = Release|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D00C8129-D2BC-4710-BDC0-FAAA640B0871}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -115,6 +121,7 @@ Global
{2F0E00EA-4A5A-48C9-B0AA-1A4AA015B372} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67} {2F0E00EA-4A5A-48C9-B0AA-1A4AA015B372} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67} {59ADCCA8-AD1D-42FB-AA6E-3A8D8AAE26C5} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{C9ED623A-9298-4644-BA5C-36BBFBC52CFF} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67} {C9ED623A-9298-4644-BA5C-36BBFBC52CFF} = {A8B7DE3D-5EBA-435C-A2CC-FB308B909A67}
{D00C8129-D2BC-4710-BDC0-FAAA640B0871} = {C76D0C23-1FFA-4963-93CD-E12BD643F030}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92F3083D-793F-4552-8A9A-0AD6534159C9} SolutionGuid = {92F3083D-793F-4552-8A9A-0AD6534159C9}

@ -22,7 +22,7 @@ namespace RelationApi
public async Task<Champion?> AddItem(Champion? item) public async Task<Champion?> AddItem(Champion? item)
{ {
HttpResponseMessage response = await _httpClient.PostAsJsonAsync(); throw new NotImplementedException();
} }
public Task<bool> DeleteItem(Champion? item) public Task<bool> DeleteItem(Champion? item)
@ -30,9 +30,9 @@ namespace RelationApi
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false) public async Task<IEnumerable<Champion?>> GetItems(int index, int count, string? orderingPropertyName = null, bool descending = false)
{ {
throw new NotImplementedException(); return await _httpClient.GetFromJsonAsync<IEnumerable<Champion?>>(IpApi + "GetItems");
} }
public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false) public Task<IEnumerable<Champion?>> GetItemsByCharacteristic(string charName, int index, int count, string? orderingPropertyName = null, bool descending = false)
@ -65,9 +65,9 @@ namespace RelationApi
throw new NotImplementedException(); throw new NotImplementedException();
} }
public Task<int> GetNbItems() public async Task<int> GetNbItems()
{ {
throw new NotImplementedException(); return await _httpClient.GetFromJsonAsync<int>(IpApi + "GetNbItems");
} }
public Task<int> GetNbItemsByCharacteristic(string charName) public Task<int> GetNbItemsByCharacteristic(string charName)

@ -8,6 +8,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\EntityFramwork\EntityFramwork.csproj" />
<ProjectReference Include="..\..\Model\Model.csproj" /> <ProjectReference Include="..\..\Model\Model.csproj" />
<ProjectReference Include="..\..\StubLib\StubLib.csproj" /> <ProjectReference Include="..\..\StubLib\StubLib.csproj" />
</ItemGroup> </ItemGroup>

@ -1,5 +1,6 @@
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using EntityFramwork.Manager;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Model; using Model;
using StubLib; using StubLib;
@ -16,7 +17,7 @@ namespace ConsoleTests
try try
{ {
using var servicesProvider = new ServiceCollection() using var servicesProvider = new ServiceCollection()
.AddSingleton<IDataManager, StubData>() .AddSingleton<IDataManager, Manager>()
.BuildServiceProvider(); .BuildServiceProvider();
dataManager = servicesProvider.GetRequiredService<IDataManager>(); dataManager = servicesProvider.GetRequiredService<IDataManager>();

@ -82,6 +82,7 @@
<MauiImage Include="Resources\Images\rp.png" /> <MauiImage Include="Resources\Images\rp.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Sources\RelationApi\RelationApi.csproj" />
<ProjectReference Include="..\Model\Model.csproj" /> <ProjectReference Include="..\Model\Model.csproj" />
<ProjectReference Include="..\Shared\Shared.csproj" /> <ProjectReference Include="..\Shared\Shared.csproj" />
<ProjectReference Include="..\StubLib\StubLib.csproj" /> <ProjectReference Include="..\StubLib\StubLib.csproj" />

@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Maui.Handlers; using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform; using Microsoft.Maui.Platform;
using Model; using Model;
using RelationApi;
using StubLib; using StubLib;
using ViewModels; using ViewModels;
@ -23,15 +24,22 @@ public static class MauiProgram
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("Font Awesome 6 Free-Solid-900.otf", "FASolid"); fonts.AddFont("Font Awesome 6 Free-Solid-900.otf", "FASolid");
}); });
/// ICI CHANGER LE SINGLETON /// ICI CHANGER LE SINGLETON
/*
builder.Services.AddSingleton<IDataManager, StubData>() builder.Services.AddSingleton<IDataManager, StubData>()
.AddSingleton<ChampionsMgrVM>() .AddSingleton<ChampionsMgrVM>()
.AddSingleton<SkinsMgrVM>() .AddSingleton<SkinsMgrVM>()
.AddSingleton<ApplicationVM>() .AddSingleton<ApplicationVM>()
.AddSingleton<ChampionsPage>(); .AddSingleton<ChampionsPage>();
*/
builder.Services.AddSingleton<IDataManager,Relation>()
.AddSingleton<ChampionsMgrVM>()
.AddSingleton<SkinsMgrVM>()
.AddSingleton<ApplicationVM>()
.AddSingleton<ChampionsPage>();
#if DEBUG #if DEBUG
builder.Logging.AddDebug(); builder.Logging.AddDebug();
#endif #endif
return builder.Build(); return builder.Build();

Loading…
Cancel
Save