Initial commit
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Contexts\Contexts.csproj" />
|
||||
<ProjectReference Include="..\Model\Model.csproj" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="7.0.0-preview.2.22153.1" />
|
||||
|
||||
<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">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.0-preview.2.22153.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0-preview.2.22153.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0-preview.2.22153.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Text.Json;
|
||||
using Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
var webProjectName = "IGP";
|
||||
var projectPath = $"{Environment.CurrentDirectory}/../../../..";
|
||||
var webPath = $"{projectPath}/{webProjectName}/wwwroot/json";
|
||||
|
||||
var options = new DbContextOptionsBuilder<DatabaseContext>();
|
||||
options.UseSqlite($"Filename={projectPath}/{webProjectName}/Database.db");
|
||||
|
||||
// Load our database
|
||||
using (var db = new DatabaseContext(options.Options)) {
|
||||
// And save data in format Blazor Wasm can use
|
||||
File.WriteAllTextAsync($"{webPath}/PatchModels.json", JsonSerializer.Serialize(db.PatchModels));
|
||||
File.WriteAllTextAsync($"{webPath}/ChangeModels.json", JsonSerializer.Serialize(db.ChangeModels));
|
||||
File.WriteAllTextAsync($"{webPath}/SprintModels.json", JsonSerializer.Serialize(db.SprintModels));
|
||||
File.WriteAllTextAsync($"{webPath}/TaskModels.json", JsonSerializer.Serialize(db.TaskModels));
|
||||
File.WriteAllTextAsync($"{webPath}/WebSectionModels.json", JsonSerializer.Serialize(db.WebSectionModels));
|
||||
File.WriteAllTextAsync($"{webPath}/WebPageModels.json", JsonSerializer.Serialize(db.WebPageModels));
|
||||
}
|
||||
Reference in New Issue
Block a user