49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using Cowain.Base.DBContext;
|
|
using Cowain.Base.Helpers;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace Cowain.Base.Models.Admins;
|
|
|
|
[Table("user_role")]
|
|
public class UserRoleDto : BaseModel
|
|
{
|
|
[Key]
|
|
public int Id { get; set; }
|
|
/// <summary>
|
|
/// 角色名称
|
|
/// </summary>
|
|
[Required]
|
|
public string RoleName { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// 最后一次更新时间
|
|
/// </summary>
|
|
public DateTime UpdateTime { get; set; } = DateTime.MinValue;
|
|
public bool IsValid { get; set; }
|
|
}
|
|
|
|
|
|
|
|
public class UserRoleSeed : IDataSeeding
|
|
{
|
|
public void DataSeeding(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<UserRoleDto>().HasData(
|
|
new UserRoleDto
|
|
{
|
|
Id = 1,
|
|
RoleName = "管理员",
|
|
IsValid = true
|
|
}
|
|
);
|
|
|
|
}
|
|
}
|