irc-netcore-api/IRaCIS.Core.Application/Helper/Attribute/DictionaryTranslateAttribut...

56 lines
1.6 KiB
C#

using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Helper
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = false)]
public class DictionaryTranslateAttribute : Attribute
{
public string DicParentCode { get; set; }
public DicDataTypeEnum DataTypeEnum { get; set; }
public CriterionType? CriterionType { get; set; }
//是否翻译依赖其他属性
public bool IsTranslateDenpendOtherProperty =>!string.IsNullOrWhiteSpace(DependPropertyName);
public string DependPropertyName { get; set; }=string.Empty;
public string DependPropertyValueStr { get; set; } = string.Empty;
// 普通翻译的字典
public DictionaryTranslateAttribute(string dicParentCode)
{
DicParentCode = dicParentCode;
}
//针对不同的标准 翻译的字典不一样
public DictionaryTranslateAttribute(string dicParentCode, CriterionType criterionType )
{
DicParentCode = dicParentCode;
CriterionType = criterionType;
}
//针对业务某个属性的值 不一样 用的翻译字典不一样
public DictionaryTranslateAttribute(string dicParentCode,string dependPropertyName, string dependPropertyValueStr)
{
DicParentCode = dicParentCode;
DependPropertyName = dependPropertyName;
DependPropertyValueStr = dependPropertyValueStr;
}
}
}