28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
using Company.Domain.RewardAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
using System;
|
|
using _0_Framework.Application;
|
|
using CompanyManagment.App.Contracts.Reward.Enums;
|
|
|
|
namespace CompanyManagment.EFCore.Mapping;
|
|
|
|
public class RewardMapping:IEntityTypeConfiguration<Reward>
|
|
{
|
|
public void Configure(EntityTypeBuilder<Reward> builder)
|
|
{
|
|
builder.ToTable("Rewards");
|
|
builder.HasKey(x => x.id);
|
|
builder.Property(x=>x.IsActive).HasConversion(
|
|
v => v.ToString(),
|
|
v => (IsActive)Enum.Parse(typeof(IsActive), v)).HasMaxLength(5);
|
|
builder.Property(x => x.Description).HasColumnType("ntext");
|
|
builder.Property(x => x.Title).HasMaxLength(255);
|
|
|
|
builder.Property(x => x.RewardType).HasConversion<string>().HasMaxLength(50);
|
|
|
|
builder.Property(x => x.CreatedByUserType).HasConversion<string>().HasMaxLength(50);
|
|
builder.Property(x => x.LastModifiedByUserType).HasConversion<string>().HasMaxLength(50);
|
|
|
|
}
|
|
} |