using Dilon.Core.Service;
using Furion;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
///
/// 参数配置表
///
[Table("sys_config")]
[Comment("参数配置表")]
public class SysConfig : DEntityBase, IEntityChangedListener
{
///
/// 名称
///
[Comment("名称")]
public string Name { get; set; }
///
/// 编码
///
[Comment("编码")]
public string Code { get; set; }
///
/// 属性值
///
[Comment("属性值")]
public string Value { get; set; }
///
/// 是否是系统参数(Y-是,N-否)
///
[Comment("是否是系统参数")]
public string SysFlag { get; set; }
///
/// 备注
///
[Comment("备注")]
public string Remark { get; set; }
///
/// 状态(字典 0正常 1停用 2删除)
///
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
///
/// 常量所属分类的编码,来自于“常量的分类”字典
///
[Comment("常量所属分类的编码")]
public string GroupCode { get; set; }
///
/// 监听实体更改之后
///
///
///
///
///
///
public void OnChanged(SysConfig newEntity, SysConfig oldEntity, DbContext dbContext, Type dbContextLocator, EntityState state)
{
// 刷新配置缓存
App.GetService().UpdateConfigCache(newEntity.Code, newEntity.Value);
}
}
}