Working on Networking
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace Server.Data;
|
||||
|
||||
public sealed class ItemTemplate
|
||||
{
|
||||
public ulong Id { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public byte ItemType { get; set; } = 1;
|
||||
public byte Rarity { get; set; } = 1;
|
||||
public uint MaxStack { get; set; } = 1;
|
||||
public uint Weight { get; set; } = 0;
|
||||
public string? StatsJson { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
|
||||
public sealed class ItemTemplateConfig : IEntityTypeConfiguration<ItemTemplate>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<ItemTemplate> e)
|
||||
{
|
||||
e.ToTable("item_templates");
|
||||
e.HasKey(x => x.Id);
|
||||
e.Property(x => x.Id).ValueGeneratedOnAdd();
|
||||
e.Property(x => x.Name).HasMaxLength(64).IsRequired();
|
||||
e.HasIndex(x => x.Name).IsUnique();
|
||||
e.Property(x => x.StatsJson).HasColumnType("json");
|
||||
e.Property(x => x.CreatedAt).HasDefaultValueSql("CURRENT_TIMESTAMP(6)");
|
||||
e.Property(x => x.UpdatedAt).HasDefaultValueSql("CURRENT_TIMESTAMP(6)")
|
||||
.ValueGeneratedOnAddOrUpdate();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user