add csfloat api usage
This commit is contained in:
@@ -8,19 +8,34 @@ public class SkinInstanceConfiguration : IEntityTypeConfiguration<SkinInstance>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SkinInstance> entity)
|
||||
{
|
||||
entity.Property(e => e.FloatValue).HasColumnType("numeric(10,9)");
|
||||
// Full precision so exact-match dupe detection isn't defeated by rounding.
|
||||
// CSFloat returns deterministic ~17-digit floats; numeric(20,18) holds them.
|
||||
entity.Property(e => e.FloatValue).HasColumnType("numeric(20,18)");
|
||||
|
||||
// Primary lookup key for trade fingerprinting.
|
||||
entity.HasIndex(e => e.FloatValue);
|
||||
entity.HasIndex(e => e.PaintSeed);
|
||||
// The fingerprint that identifies a physical item. NOT unique: duped items
|
||||
// legitimately share a fingerprint, and detecting that collision is the
|
||||
// point. Indexed for fast fingerprint resolution during the sweep.
|
||||
entity.HasIndex(e => new
|
||||
{
|
||||
e.SkinId,
|
||||
e.FloatValue,
|
||||
e.PaintSeed,
|
||||
e.StatTrak,
|
||||
e.Souvenir,
|
||||
});
|
||||
|
||||
// Surfacing fresh dupes is a hot query.
|
||||
entity.HasIndex(e => e.SuspectedDupe);
|
||||
|
||||
entity.HasOne(e => e.Skin)
|
||||
.WithMany(s => s.Instances)
|
||||
.HasForeignKey(e => e.SkinId);
|
||||
|
||||
// Condition is optional now (derived from float later); set null on delete
|
||||
// rather than restrict so condition rows can change without blocking.
|
||||
entity.HasOne(e => e.Condition)
|
||||
.WithMany(c => c.Instances)
|
||||
.HasForeignKey(e => e.ConditionId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user