New version

This commit is contained in:
2025-07-11 00:18:14 +02:00
parent 6b6c90272c
commit 49038de2b5
341 changed files with 18364 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.7"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.7"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.7"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Design" Version="1.1.6"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Drab.LocalDb.Entities;
public class OrderDb
{
[Key]
public long OrderId { get; set; }
public long DokId { get; set; }
public DateTime Created { get; set; }
public bool IsPrinted { get; set; }
public string Filename { get; set; }
public string Shop { get; set; }
public string OrderNumber { get; set; }
}

View File

@@ -0,0 +1,6 @@
namespace Drab.LocalDb.IoC;
public interface ILocalDbConfiguration
{
public string ConnectionString { get; set; }
}

View File

@@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace Drab.LocalDb.IoC;
public static class IocLocalDbRegister
{
public static IServiceCollection AddLocalDatabase(this IServiceCollection services, ILocalDbConfiguration localDbConfiguration)
{
services.AddDbContext<LocalDbContext>(cx => cx.UseSqlite(localDbConfiguration.ConnectionString));
return services;
}
}

View File

@@ -0,0 +1,18 @@
using Drab.LocalDb.Entities;
using Microsoft.EntityFrameworkCore;
namespace Drab.LocalDb;
public class LocalDbContext : DbContext
{
public LocalDbContext()
{
}
public LocalDbContext(DbContextOptions<LocalDbContext> options)
: base(options)
{
}
public DbSet<OrderDb> Orders { get; set; }
}

View File

@@ -0,0 +1,52 @@
// <auto-generated />
using System;
using Drab.LocalDb;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Drab.LocalDb.Migrations
{
[DbContext(typeof(LocalDbContext))]
[Migration("20211101180516_Initial")]
partial class Initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Drab.LocalDb.Entities.OrderDb", b =>
{
b.Property<long>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
b.Property<long>("DokId")
.HasColumnType("INTEGER");
b.Property<string>("Filename")
.HasColumnType("TEXT");
b.Property<bool>("IsPrinted")
.HasColumnType("INTEGER");
b.Property<string>("OrderNumber")
.HasColumnType("TEXT");
b.Property<string>("Shop")
.HasColumnType("TEXT");
b.HasKey("OrderId");
b.ToTable("Orders");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Drab.LocalDb.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
OrderId = table.Column<long>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
DokId = table.Column<long>(type: "INTEGER", nullable: false),
Created = table.Column<DateTime>(type: "TEXT", nullable: false),
IsPrinted = table.Column<bool>(type: "INTEGER", nullable: false),
Filename = table.Column<string>(type: "TEXT", nullable: true),
Shop = table.Column<string>(type: "TEXT", nullable: true),
OrderNumber = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Orders", x => x.OrderId);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Orders");
}
}
}

View File

@@ -0,0 +1,50 @@
// <auto-generated />
using System;
using Drab.LocalDb;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Drab.LocalDb.Migrations
{
[DbContext(typeof(LocalDbContext))]
partial class LocalDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("Drab.LocalDb.Entities.OrderDb", b =>
{
b.Property<long>("OrderId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
b.Property<long>("DokId")
.HasColumnType("INTEGER");
b.Property<string>("Filename")
.HasColumnType("TEXT");
b.Property<bool>("IsPrinted")
.HasColumnType("INTEGER");
b.Property<string>("OrderNumber")
.HasColumnType("TEXT");
b.Property<string>("Shop")
.HasColumnType("TEXT");
b.HasKey("OrderId");
b.ToTable("Orders");
});
#pragma warning restore 612, 618
}
}
}