You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
using AX.FireTrainingSys.Models; |
|
using Microsoft.EntityFrameworkCore; |
|
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Threading.Tasks; |
|
|
|
namespace AX.FireTrainingSys.EntityConfigurations |
|
{ |
|
public class UserConfig : IEntityTypeConfiguration<User> |
|
{ |
|
public void Configure(EntityTypeBuilder<User> entity) |
|
{ |
|
entity.Property(e => e.Id) |
|
.IsUnicode(false) |
|
.HasValueGenerator<ObjectIdGenerator>(); |
|
|
|
entity.Property(e => e.Name) |
|
.IsUnicode(false); |
|
|
|
entity.Property(e => e.Password) |
|
.IsUnicode(false); |
|
|
|
entity.Property(e => e.CreationTime) |
|
.HasConversion(ConverterHelper.DateTimeToStringConverter()); |
|
|
|
entity.HasIndex(e => e.Id); |
|
entity.HasIndex(e => e.Name).IsUnique(); |
|
entity.HasIndex(e => e.RealName); |
|
entity.HasIndex(e => e.CreationTime); |
|
|
|
entity.HasQueryFilter(e => !e.Deleted); |
|
} |
|
} |
|
}
|
|
|