feat(Immortal) Disabling SQL
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;NO_SQL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE;NO_SQL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@implements IDisposable
|
||||
|
||||
|
||||
|
||||
<div onmouseleave="@HoverOut" class="desktopNavContainer">
|
||||
<div class="menuHeader" @onmouseover="() => NavigationService.ChangeNavigationState(NavigationStateType.Hovering_Menu)">
|
||||
<NavLink href="/" class="websiteTitle">
|
||||
@@ -98,11 +100,20 @@
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public List<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<WebPageModel> WebPages { get; set; }
|
||||
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<WebPageModel> WebPages { get; set; }
|
||||
#endif
|
||||
|
||||
protected override void OnInitialized() {
|
||||
NavigationService.Subscribe(StateHasChanged);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
@using Model.Website
|
||||
|
||||
|
||||
@using Model.Website
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
<div class="mobileFooter">
|
||||
<div class="mobileNavSectionsContainer">
|
||||
@@ -136,12 +138,20 @@
|
||||
</style>
|
||||
|
||||
@code {
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public List<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<WebPageModel> WebPages { get; set; }
|
||||
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<WebPageModel> WebPages { get; set; }
|
||||
#endif
|
||||
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; }
|
||||
|
||||
@@ -142,11 +142,21 @@
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public List<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<WebPageModel> WebPages { get; set; }
|
||||
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<WebPageModel> WebPages { get; set; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
bool NavOpen = true;
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;
|
||||
NO_SQL;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE;
|
||||
NO_SQL;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0-preview.2.22153.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.0-preview.2.22153.1">
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model.Website;
|
||||
using Model.Work.Git;
|
||||
using Model.Work.Tasks;
|
||||
@@ -24,3 +28,5 @@ public class DatabaseContext : DbContext {
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
+11
-1
@@ -1,5 +1,4 @@
|
||||
@inject HttpClient HttpClient
|
||||
@inject DatabaseContext Database
|
||||
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
@@ -28,3 +27,14 @@
|
||||
text-decoration-thickness: 3px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
[Inject]
|
||||
DatabaseContext Database { get; set; }
|
||||
#endif
|
||||
|
||||
}
|
||||
+20
-2
@@ -7,14 +7,32 @@
|
||||
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;NO_SQL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE;NO_SQL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Pages\Agile\AgilePage.razor.css" />
|
||||
<None Remove="Pages\ChangeLogPage.razor.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Pages\Agile\AgilePage.razor.css" />
|
||||
<Content Include="Pages\ChangeLogPage.razor.css" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-preview.2.22153.2" PrivateAssets="all" />
|
||||
|
||||
<!--
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1" />
|
||||
<NativeFileReference Include="e_sqlite3.o" />
|
||||
<NativeFileReference Include="e_sqlite3.o" /> -->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+20
-7
@@ -3,30 +3,37 @@
|
||||
@inject IWebsiteService WebService;
|
||||
@implements IDisposable;
|
||||
|
||||
@inject DatabaseContext Database;
|
||||
<div class="layoutContainer" @onclick="OnPageClicked">
|
||||
@if (!WebService.IsLoaded()) {
|
||||
<LoadingComponent></LoadingComponent>
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
<div class="content">
|
||||
@Body
|
||||
</div>
|
||||
|
||||
|
||||
<DesktopNavComponent WebSections=WebService.WebSectionModels
|
||||
WebPages=WebService.WebPageModels />
|
||||
<TabletNavComponent WebSections=WebService.WebSectionModels
|
||||
WebPages=WebService.WebPageModels />
|
||||
<MobileNavComponent WebSections=WebService.WebSectionModels
|
||||
WebPages=WebService.WebPageModels />
|
||||
|
||||
|
||||
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
bool NavOpen = true;
|
||||
|
||||
void OnNavClicked(EventArgs eventArgs) {
|
||||
NavOpen = !NavOpen;
|
||||
}
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
[Inject]
|
||||
DatabaseContext Database { get; set; }
|
||||
#endif
|
||||
|
||||
bool NavOpen = true;
|
||||
|
||||
void OnPageClicked(EventArgs eventArgs) {
|
||||
NavOpen = false;
|
||||
@@ -37,7 +44,13 @@
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync() {
|
||||
|
||||
#if NO_SQL
|
||||
await WebService.Load();
|
||||
#else
|
||||
await WebService.Load(Database);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
@implements IDisposable;
|
||||
@inject IAgileService AgileService;
|
||||
@inject DatabaseContext Database;
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
@@ -19,10 +18,18 @@
|
||||
<div style="flex: 1; flex-grow: 1;"></div>
|
||||
<div class="sprintDates">
|
||||
<div class="sprintStartDate">
|
||||
@if (sprint.StartDate != null)
|
||||
{
|
||||
<b>Start: </b>@sprint.StartDate.Value.ToString("dd/MM/yyyy")
|
||||
}
|
||||
</div>
|
||||
<div class="sprintEndDate">
|
||||
@if (sprint.EndDate != null)
|
||||
{
|
||||
<b>End: </b>@sprint.EndDate.Value.ToString("dd/MM/yyyy")
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</summary>
|
||||
@@ -60,88 +67,27 @@ else {
|
||||
}
|
||||
|
||||
|
||||
<style>
|
||||
.agileViewContainer {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sprintDisplayContainer {
|
||||
border: 4px solid var(--paper);
|
||||
box-shadow: 0px 2px 12px rgba(0,0,0,0.2);
|
||||
border-radius: 2px;
|
||||
padding: 25px;
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
background-color:var(--paper);
|
||||
}
|
||||
|
||||
@@media only screen and (max-width: 1025px) {
|
||||
.sprintDisplayContainer {
|
||||
padding: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.sprintSummary {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.@SprintType.Current.ToLower() {
|
||||
border-color: #042901;
|
||||
background-color:var(--paper);
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.@SprintType.Planned.ToLower() {
|
||||
border-color: #2a2000;
|
||||
background-color:var(--paper);
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.@SprintType.Completed.ToLower() {
|
||||
border-color: #2a2000;
|
||||
background-color:var(--paper);
|
||||
}
|
||||
|
||||
|
||||
details .sprintSummary::before {
|
||||
content: "+";
|
||||
font-weight: bolder;
|
||||
font-size: 1.5rem;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
details[open] .sprintSummary::before {
|
||||
content: "-";
|
||||
}
|
||||
|
||||
|
||||
.sprintTitle {
|
||||
width: 400px;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.sprintDates {
|
||||
width: 160px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public DbSet<SprintModel> Sprints { get; set; }
|
||||
public List<TaskModel> Tasks { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<SprintModel> Sprints { get; set; }
|
||||
#else
|
||||
[Inject]
|
||||
DatabaseContext Database { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<TaskModel> Tasks { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<SprintModel> Sprints { get; set; }
|
||||
#endif
|
||||
|
||||
private readonly List<TaskModel> backlog = new();
|
||||
|
||||
|
||||
protected override void OnInitialized() {
|
||||
AgileService.Subscribe(HasChanged);
|
||||
}
|
||||
@@ -166,7 +112,11 @@ details[open] .sprintSummary::before {
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync() {
|
||||
#if NO_SQL
|
||||
await AgileService.Load();
|
||||
#else
|
||||
await AgileService.Load(Database);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
.agileViewContainer {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sprintDisplayContainer {
|
||||
border: 4px solid var(--paper);
|
||||
box-shadow: 0px 2px 12px rgba(0,0,0,0.2);
|
||||
border-radius: 2px;
|
||||
padding: 25px;
|
||||
margin: auto;
|
||||
width: 100%;
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1025px) {
|
||||
.sprintDisplayContainer {
|
||||
padding: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.sprintSummary {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.current {
|
||||
border-color: #042901;
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.planned {
|
||||
border-color: #2a2000;
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
.sprintDisplayContainer.completed {
|
||||
border-color: #2a2000;
|
||||
background-color: var(--paper);
|
||||
}
|
||||
|
||||
|
||||
details .sprintSummary::before {
|
||||
content: "+";
|
||||
font-weight: bolder;
|
||||
font-size: 1.5rem;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
details[open] .sprintSummary::before {
|
||||
content: "-";
|
||||
}
|
||||
|
||||
|
||||
.sprintTitle {
|
||||
width: 400px;
|
||||
font-size: 1.6rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.sprintDates {
|
||||
width: 160px;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -221,11 +221,16 @@
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public SprintModel Sprint { get; set; }
|
||||
|
||||
public List<TaskModel> Tasks { get; set; }
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<TaskModel> Tasks { get; set; }
|
||||
#endif
|
||||
|
||||
[Parameter]
|
||||
public SprintModel Sprint { get; set; }
|
||||
|
||||
private List<TaskModel> selectedTasks { get; set; }
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@page "/changelog"
|
||||
@implements IDisposable;
|
||||
@inject IGitService GitService;
|
||||
@inject DatabaseContext Database;
|
||||
|
||||
@layout PageLayout
|
||||
|
||||
@@ -47,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
@foreach (var change in patch.ChangeModels) {
|
||||
@foreach (var change in Changes.FindAll(e => e.PatchModelId == patch.Id)) {
|
||||
@if (!change.Important.Equals("True") && isViewImportant) {
|
||||
continue;
|
||||
}
|
||||
@@ -56,12 +55,12 @@
|
||||
<div>
|
||||
<div>
|
||||
<b>
|
||||
- @change.Name
|
||||
<span>- @change.Name </span>
|
||||
|
||||
@if (change.Commit != CommitType.None) {
|
||||
<span>(@change.Commit)</span>
|
||||
}
|
||||
:
|
||||
<span>: </span>
|
||||
</b> @((MarkupString)change.Description)
|
||||
</div>
|
||||
</div>
|
||||
@@ -70,8 +69,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
}
|
||||
|
||||
</PaperComponent>
|
||||
@@ -84,11 +81,22 @@ else {
|
||||
|
||||
@code {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter]
|
||||
public List<PatchModel> Patches { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<ChangeModel> Changes { get; set; }
|
||||
#else
|
||||
[Inject]
|
||||
DatabaseContext Database { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<PatchModel> Patches { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<ChangeModel> Changes { get; set; }
|
||||
#endif
|
||||
|
||||
private bool isViewImportant = true;
|
||||
|
||||
@@ -113,7 +121,11 @@ else {
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync() {
|
||||
#if NO_SQL
|
||||
GitService.Load();
|
||||
#else
|
||||
GitService.Load(Database);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
.patchContainer {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1025px) {
|
||||
.patchContainer {
|
||||
border: none;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
}
|
||||
+13
-2
@@ -1,7 +1,14 @@
|
||||
using Contexts;
|
||||
|
||||
using IGP;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
#endif
|
||||
|
||||
using Services;
|
||||
using Services.Immortal;
|
||||
using Services.Website;
|
||||
@@ -31,7 +38,11 @@ builder.Services.AddSingleton(new HttpClient {
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddDbContext<DatabaseContext>(options => { options.UseSqlite("Data Source=./Database.db"); });
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
//builder.Services.AddDbContext<DatabaseContext>(options => { options.UseSqlite("Data Source=./Database.db"); });
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IWebsiteService, WebsiteService>();
|
||||
builder.Services.AddSingleton<IAgileService, AgileService>();
|
||||
|
||||
+3
-2
@@ -1,4 +1,6 @@
|
||||
@using Components.Display
|
||||
|
||||
|
||||
@using Components.Display
|
||||
@using Components.Feedback
|
||||
@using Components.Form
|
||||
@using Components.Info
|
||||
@@ -7,7 +9,6 @@
|
||||
@using Components.Navigation
|
||||
@using Components.Shared
|
||||
@using Components.Utils
|
||||
@using Contexts
|
||||
@using IGP.Pages
|
||||
@using IGP.Pages.Agile.Parts
|
||||
@using IGP.Pages.BuildCalculator.Parts
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Net.Http.Json;
|
||||
|
||||
|
||||
using System.Net.Http.Json;
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model.Work.Tasks;
|
||||
@@ -14,9 +16,17 @@ public class AgileService : IAgileService {
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
public List<SprintModel> SprintModels { get; set; }
|
||||
public List<TaskModel> TaskModels { get; set; }
|
||||
#else
|
||||
|
||||
private DatabaseContext Database { get; set; }
|
||||
public DbSet<SprintModel> SprintModels => Database.SprintModels;
|
||||
public DbSet<TaskModel> TaskModels => Database.TaskModels;
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action action) {
|
||||
_onChange += action;
|
||||
@@ -30,10 +40,26 @@ public class AgileService : IAgileService {
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
#if NO_SQL
|
||||
public async Task Load() {
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
SprintModels = (await httpClient.GetFromJsonAsync<SprintModel[]>("generated/SprintModels.json")).ToList();
|
||||
TaskModels =(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/TaskModels.json")).ToList();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
#else
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) return;
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
Database.SprintModels.AddRange(await httpClient.GetFromJsonAsync<SprintModel[]>("generated/SprintModels.json"));
|
||||
Database.TaskModels.AddRange(await httpClient.GetFromJsonAsync<TaskModel[]>("generated/TaskModels.json"));
|
||||
@@ -44,6 +70,7 @@ public class AgileService : IAgileService {
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
#endif
|
||||
|
||||
public void Update() {
|
||||
NotifyDataChanged();
|
||||
@@ -1,7 +1,14 @@
|
||||
using System.Net.Http.Json;
|
||||
|
||||
|
||||
using System.Net.Http.Json;
|
||||
using Model.Work.Git;
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
#else
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model.Work.Git;
|
||||
#endif
|
||||
|
||||
namespace Services.Work;
|
||||
|
||||
@@ -14,9 +21,16 @@ public class GitService : IGitService {
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
public DatabaseContext Database { get; set; }
|
||||
#if NO_SQL
|
||||
public List<ChangeModel> ChangeModels { get; set; }
|
||||
public List<PatchModel> PatchModels { get; set; }
|
||||
#else
|
||||
public DbSet<ChangeModel> ChangeModels => Database.ChangeModels;
|
||||
public DbSet<PatchModel> PatchModels => Database.PatchModels;
|
||||
public DatabaseContext Database { get; set; }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
public void Subscribe(Action action) {
|
||||
_onChange += action;
|
||||
@@ -30,20 +44,46 @@ public class GitService : IGitService {
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) return;
|
||||
#if NO_SQL
|
||||
|
||||
public async Task Load() {
|
||||
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
ChangeModels = (await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/ChangeModels.json")).ToList();
|
||||
PatchModels = (await httpClient.GetFromJsonAsync<PatchModel[]>("generated/PatchModels.json")).ToList();
|
||||
|
||||
Database.ChangeModels.AddRange(await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/ChangeModels.json"));
|
||||
Database.PatchModels.AddRange(await httpClient.GetFromJsonAsync<PatchModel[]>("generated/PatchModels.json"));
|
||||
Database.SaveChanges();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
Database.ChangeModels.AddRange(await httpClient.GetFromJsonAsync<ChangeModel[]>("generated/ChangeModels.json"));
|
||||
Database.PatchModels.AddRange(await httpClient.GetFromJsonAsync<PatchModel[]>("generated/PatchModels.json"));
|
||||
Database.SaveChanges();
|
||||
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
public void Update() {
|
||||
NotifyDataChanged();
|
||||
}
|
||||
+47
-7
@@ -1,4 +1,6 @@
|
||||
using Contexts;
|
||||
|
||||
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Model.Immortal.BuildOrders;
|
||||
using Model.Immortal.Economy;
|
||||
@@ -12,34 +14,72 @@ using Services.Immortal;
|
||||
|
||||
namespace Services;
|
||||
|
||||
public interface IAgileService {
|
||||
public DbSet<SprintModel> SprintModels { get; }
|
||||
public DbSet<TaskModel> TaskModels { get; }
|
||||
public interface IWebsiteService {
|
||||
#if NO_SQL
|
||||
public List<WebPageModel> WebPageModels { get; set; }
|
||||
public List<WebSectionModel> WebSectionModels { get; set; }
|
||||
#else
|
||||
public DbSet<WebPageModel> WebPageModels { get; }
|
||||
public DbSet<WebSectionModel> WebSectionModels { get; }
|
||||
#endif
|
||||
|
||||
public void Subscribe(Action action);
|
||||
public void Unsubscribe(Action action);
|
||||
public void Update();
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
public Task Load();
|
||||
#else
|
||||
|
||||
public Task Load(DatabaseContext database);
|
||||
#endif
|
||||
|
||||
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface IWebsiteService {
|
||||
public DbSet<WebPageModel> WebPageModels { get; }
|
||||
public DbSet<WebSectionModel> WebSectionModels { get; }
|
||||
public interface IAgileService {
|
||||
|
||||
#if NO_SQL
|
||||
public List<SprintModel> SprintModels { get; set; }
|
||||
public List<TaskModel> TaskModels { get; set; }
|
||||
#else
|
||||
public DbSet<SprintModel> SprintModels { get; }
|
||||
public DbSet<TaskModel> TaskModels { get; }
|
||||
#endif
|
||||
|
||||
public void Subscribe(Action action);
|
||||
public void Unsubscribe(Action action);
|
||||
public void Update();
|
||||
|
||||
#if NO_SQL
|
||||
public Task Load();
|
||||
#else
|
||||
public Task Load(DatabaseContext database);
|
||||
#endif
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
public interface IGitService {
|
||||
|
||||
#if NO_SQL
|
||||
public List<ChangeModel> ChangeModels { get; set; }
|
||||
public List<PatchModel> PatchModels { get; set; }
|
||||
#else
|
||||
public DbSet<ChangeModel> ChangeModels { get; }
|
||||
public DbSet<PatchModel> PatchModels { get; }
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action action);
|
||||
public void Unsubscribe(Action action);
|
||||
public void Update();
|
||||
#if NO_SQL
|
||||
public Task Load();
|
||||
#else
|
||||
public Task Load(DatabaseContext database);
|
||||
#endif
|
||||
public bool IsLoaded();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants>TRACE;NO_SQL</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DefineConstants>TRACE;NO_SQL;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -14,9 +14,20 @@ public class WebsiteService : IWebsiteService {
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
public List<WebSectionModel> WebSectionModels { get; set; }
|
||||
public List<WebPageModel> WebPageModels { get; set; }
|
||||
#else
|
||||
|
||||
private DatabaseContext Database { get; set; }
|
||||
|
||||
|
||||
public DbSet<WebSectionModel> WebSectionModels => Database.WebSectionModels;
|
||||
public DbSet<WebPageModel> WebPageModels => Database.WebPageModels;
|
||||
#endif
|
||||
|
||||
|
||||
public void Subscribe(Action action) {
|
||||
_onChange += action;
|
||||
@@ -30,10 +41,23 @@ public class WebsiteService : IWebsiteService {
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
public async Task Load() {
|
||||
if (isLoaded) {return;}
|
||||
|
||||
WebPageModels = (await httpClient.GetFromJsonAsync<WebPageModel[]>("generated/WebPageModels.json")).ToList();
|
||||
WebSectionModels =(await httpClient.GetFromJsonAsync<WebSectionModel[]>("generated/WebSectionModels.json")).ToList();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
#else
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
if (isLoaded) return;
|
||||
if (isLoaded) {return;}
|
||||
|
||||
Database.WebPageModels.AddRange(await httpClient.GetFromJsonAsync<WebPageModel[]>("generated/WebPageModels.json"));
|
||||
Database.WebSectionModels.AddRange(
|
||||
@@ -45,6 +69,8 @@ public class WebsiteService : IWebsiteService {
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
public void Update() {
|
||||
NotifyDataChanged();
|
||||
|
||||
Reference in New Issue
Block a user