init efcore
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using BlueLaminate.EFCore.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace BlueLaminate.EFCore.Configurations;
|
||||
|
||||
public class PriceHistoryConfiguration : IEntityTypeConfiguration<PriceHistory>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<PriceHistory> entity)
|
||||
{
|
||||
entity.Property(e => e.Price).HasPrecision(18, 2);
|
||||
|
||||
entity.HasIndex(e => new { e.SkinId, e.ConditionId, e.RecordedAt });
|
||||
|
||||
entity.HasOne(e => e.Skin)
|
||||
.WithMany(s => s.PriceHistories)
|
||||
.HasForeignKey(e => e.SkinId);
|
||||
|
||||
entity.HasOne(e => e.Condition)
|
||||
.WithMany(c => c.PriceHistories)
|
||||
.HasForeignKey(e => e.ConditionId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user