Update to latest packages and show examples
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace GerstITS.Examples.Data;
|
||||
|
||||
public sealed class CustomerDbContext : EntityFrameworkDbContextBase, IDbContext
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public DbSet<CustomerEntity> Customers => Set<CustomerEntity>();
|
||||
public DbSet<CustomerNoteEntity> CustomerNotes => Set<CustomerNoteEntity>();
|
||||
|
||||
protected override string ConnectionStringName => "CustomerDbContext";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public CustomerDbContext(IDatabaseConfigurator databaseConfigurator,
|
||||
DbContextOptions<CustomerDbContext> dbContextOptions)
|
||||
: base(databaseConfigurator, dbContextOptions)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using GerstITS.Data;
|
||||
|
||||
namespace GerstITS.Examples.Data.Entities;
|
||||
|
||||
public sealed class CustomerEntity : EntityBase<int>, IActivatable, IReadOnlyActivatable, ICreatable, IReadOnlyCreatable, IModifiable, IReadOnlyModifiable, IVersionable, IReadOnlyVersionable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string EMail { get; set; }
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
public DateTime? Deactivated { get; set; }
|
||||
public string DeactivatedBy { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public DateTime? Modified { get; set; }
|
||||
public string ModifiedBy { get; set; }
|
||||
|
||||
public int Version { get; set; }
|
||||
|
||||
public ICollection<CustomerNoteEntity> Notes { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using GerstITS.Data;
|
||||
|
||||
namespace GerstITS.Examples.Data.Entities;
|
||||
|
||||
public sealed class CustomerNoteEntity : EntityBase<int>, ICreatable, IReadOnlyCreatable, IHistoricizable, IReadOnlyHistoricizable
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public int CustomerId { get; set; }
|
||||
public string Text { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
public string HistorySet { get; set; }
|
||||
public DateTime ValidFrom { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Gerst ITS</Company>
|
||||
<Authors>Gerst ITS</Authors>
|
||||
<Copyright>© 2025 Gerst ITS</Copyright>
|
||||
<Product>Gerst ITS Examples data access</Product>
|
||||
<Description>Example data access.</Description>
|
||||
<Version>0.0.0.0</Version>
|
||||
<AssemblyVersion>0.0.0.0</AssemblyVersion>
|
||||
<AssemblyInformationalVersion>0.0.0.0</AssemblyInformationalVersion>
|
||||
<FileVersion>0.0.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
<WarningsAsErrors />
|
||||
<NoWarn />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
<WarningsAsErrors />
|
||||
<NoWarn />
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GerstITS.Data" />
|
||||
<PackageReference Include="GerstITS.Data.EntityFramework" />
|
||||
<PackageReference Include="GerstITS.Data.EntityFramework.PostgreSql" />
|
||||
<PackageReference Include="GerstITS.IoC" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="appsettings.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectCapability Include="ConfigurableFileNesting" />
|
||||
<ProjectCapability Include="ConfigurableFileNestingFeatureEnabled" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,43 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GerstITS.Examples.Data.Mappings;
|
||||
|
||||
internal sealed class CustomerEntityMapping : EntityMappingBase<CustomerEntity>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
protected override string TableName => "Customers";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void AddKeyMapping(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.HasKey(i => i.Id);
|
||||
}
|
||||
|
||||
protected override void AddPropertyMappings(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.Property(i => i.FirstName).HasMaxLength(100).IsRequired();
|
||||
entity.Property(i => i.LastName).HasMaxLength(100).IsRequired();
|
||||
entity.Property(i => i.EMail).HasMaxLength(250).IsRequired();
|
||||
|
||||
entity.Property(i => i.CreatedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.ModifiedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.DeactivatedBy).HasMaxLength(100);
|
||||
|
||||
entity.Property(i => i.Version).IsConcurrencyToken();
|
||||
}
|
||||
|
||||
protected override void AddNavigationProperties(EntityTypeBuilder<CustomerEntity> entity)
|
||||
{
|
||||
entity.HasMany(i => i.Notes)
|
||||
.WithOne()
|
||||
.HasForeignKey(i => i.CustomerId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Entities;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace GerstITS.Examples.Data.Mappings;
|
||||
|
||||
internal sealed class CustomerNoteEntityMapping : EntityMappingBase<CustomerNoteEntity>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
protected override string TableName => "CustomerNotes";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
protected override void AddKeyMapping(EntityTypeBuilder<CustomerNoteEntity> entity)
|
||||
{
|
||||
entity.HasKey(i => i.Id);
|
||||
}
|
||||
|
||||
protected override void AddPropertyMappings(EntityTypeBuilder<CustomerNoteEntity> entity)
|
||||
{
|
||||
entity.Property(i => i.Text).HasMaxLength(2000).IsRequired();
|
||||
|
||||
entity.Property(i => i.CreatedBy).HasMaxLength(100);
|
||||
entity.Property(i => i.HistorySet).HasMaxLength(50);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GerstITS.Examples.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(CustomerDbContext))]
|
||||
[Migration("20260703100412_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("examples")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityAlwaysColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTime?>("Deactivated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DeactivatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("EMail")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("character varying(250)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTime?>("Modified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers", "examples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerNoteEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("HistorySet")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<DateTime>("ValidFrom")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.ToTable("CustomerNotes", "examples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerNoteEntity", b =>
|
||||
{
|
||||
b.HasOne("GerstITS.Examples.Data.Entities.CustomerEntity", null)
|
||||
.WithMany("Notes")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerEntity", b =>
|
||||
{
|
||||
b.Navigation("Notes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialCreate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "examples");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Customers",
|
||||
schema: "examples",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn),
|
||||
FirstName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
LastName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
EMail = table.Column<string>(type: "character varying(250)", maxLength: 250, nullable: false),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Deactivated = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
DeactivatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Modified = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
ModifiedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
Version = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Customers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CustomerNotes",
|
||||
schema: "examples",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityAlwaysColumn),
|
||||
CustomerId = table.Column<int>(type: "integer", nullable: false),
|
||||
Text = table.Column<string>(type: "character varying(2000)", maxLength: 2000, nullable: false),
|
||||
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CreatedBy = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
||||
HistorySet = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true),
|
||||
ValidFrom = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CustomerNotes", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CustomerNotes_Customers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalSchema: "examples",
|
||||
principalTable: "Customers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CustomerNotes_CustomerId",
|
||||
schema: "examples",
|
||||
table: "CustomerNotes",
|
||||
column: "CustomerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CustomerNotes",
|
||||
schema: "examples");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Customers",
|
||||
schema: "examples");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using GerstITS.Data.EntityFramework.PostgreSql.Migrations;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations;
|
||||
|
||||
public sealed class CustomerDatabaseConfigurator : PostgreSqlDatabaseConfiguratorBase<CustomerDbContext>
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
public CustomerDatabaseConfigurator(IConfiguration configuration)
|
||||
: base("examples", configuration)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using GerstITS.Examples.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(CustomerDbContext))]
|
||||
partial class CustomerDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("examples")
|
||||
.HasAnnotation("ProductVersion", "10.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityAlwaysColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTime?>("Deactivated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("DeactivatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<string>("EMail")
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasColumnType("character varying(250)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<DateTime?>("Modified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Customers", "examples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerNoteEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("HistorySet")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Text")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b.Property<DateTime>("ValidFrom")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.ToTable("CustomerNotes", "examples");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerNoteEntity", b =>
|
||||
{
|
||||
b.HasOne("GerstITS.Examples.Data.Entities.CustomerEntity", null)
|
||||
.WithMany("Notes")
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("GerstITS.Examples.Data.Entities.CustomerEntity", b =>
|
||||
{
|
||||
b.Navigation("Notes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
|
||||
namespace GerstITS.Examples.Data.Migrations.DesignTime;
|
||||
|
||||
public sealed class CustomerDbContextDesignTimeFactory : DesignTimeDbContextFactoryBase<CustomerDbContext>
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using GerstITS.Data.EntityFramework;
|
||||
using GerstITS.Examples.Data.Migrations;
|
||||
using GerstITS.IoC;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace GerstITS.Examples.Data;
|
||||
|
||||
public sealed class Module : IIoCModule<IServiceCollection>
|
||||
{
|
||||
#region IIoCModule
|
||||
|
||||
public void RegisterComponents(IServiceCollection container)
|
||||
{
|
||||
container.AddMigration<CustomerDbContext, CustomerDatabaseConfigurator>();
|
||||
container.AddEntityFrameworkSession<CustomerDbContext>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"CustomerDbContext": "Host=localhost;Port=5432;Database=gerstits_examples;Username=postgres;Password=postgres"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user