init efcore

This commit is contained in:
bob
2026-05-29 12:21:42 -05:00
commit 3d3a5c2a5e
28 changed files with 2071 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using BlueLaminate.EFCore.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace BlueLaminate.EFCore.Configurations;
public class SkinConfiguration : IEntityTypeConfiguration<Skin>
{
public void Configure(EntityTypeBuilder<Skin> entity)
{
entity.Property(e => e.FloatMin)
.HasColumnType("numeric(10,9)")
.HasDefaultValue(0.0m);
entity.Property(e => e.FloatMax)
.HasColumnType("numeric(10,9)")
.HasDefaultValue(1.0m);
entity.Property(e => e.TrueFloat)
.HasComputedColumnSql("float_min = 0.0 AND float_max = 1.0", stored: true);
entity.HasIndex(e => e.TrueFloat);
entity.HasOne(e => e.Weapon)
.WithMany(w => w.Skins)
.HasForeignKey(e => e.WeaponId);
}
}