mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
- 修复 CodeFirst + AsTable + 自动迁移,导致索性名重复的问题 #366;
This commit is contained in:
@ -4,14 +4,28 @@ using System.Text;
|
||||
|
||||
namespace FreeSql.DataAnnotations
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引设置,如:[Index("{tablename}_idx_01", "name")]
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
public class IndexAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引设置,如:[Index("{tablename}_idx_01", "name")]
|
||||
/// </summary>
|
||||
/// <param name="name">索引名<para></para>v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题)</param>
|
||||
/// <param name="fields">索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC</param>
|
||||
public IndexAttribute(string name, string fields)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fields = fields;
|
||||
}
|
||||
/// <summary>
|
||||
/// 索引设置,如:[Index("{tablename}_idx_01", "name", true)]
|
||||
/// </summary>
|
||||
/// <param name="name">索引名<para></para>v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题)</param>
|
||||
/// <param name="fields">索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC</param>
|
||||
/// <param name="isUnique">是否唯一</param>
|
||||
public IndexAttribute(string name, string fields, bool isUnique)
|
||||
{
|
||||
this.Name = name;
|
||||
@ -19,7 +33,8 @@ namespace FreeSql.DataAnnotations
|
||||
this.IsUnique = isUnique;
|
||||
}
|
||||
/// <summary>
|
||||
/// 索引名
|
||||
/// 索引名<para></para>
|
||||
/// v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题)
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user