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.
 
 

39 lines
1.1 KiB

using System.ComponentModel.DataAnnotations.Schema;
namespace Znyc.Cloudcar.Admin.Commons.Attributes
{
/// <summary>
/// 数据库分表特性
/// </summary>
public class ShardingTableAttribute : TableAttribute
{
/// <summary>
/// </summary>
/// <param name="name"></param>
public ShardingTableAttribute(string name) : base(name)
{
Suffix = "yyyyMMdd";
Splitter = "_";
}
/// <summary>
/// </summary>
/// <param name="name"></param>
/// <param name="splitter"></param>
/// <param name="suffix"></param>
public ShardingTableAttribute(string name, string splitter = "_", string suffix = "yyyyMMdd") : base(name)
{
Suffix = suffix;
}
/// <summary>
/// 分隔符
/// </summary>
public string Splitter { get; set; } = "_";
/// <summary>
/// 分表后缀格式。默认值:_yyyyMMdd
/// </summary>
public string Suffix { get; set; } = "yyyyMMdd";
}
}