mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-09-18 01:15:34 +08:00
代码类文件移动(不影响功能)
This commit is contained in:
36
FreeSql/DataAnnotations/IndexAttribute.cs
Normal file
36
FreeSql/DataAnnotations/IndexAttribute.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace FreeSql.DataAnnotations
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
public class IndexAttribute : Attribute
|
||||
{
|
||||
public IndexAttribute(string name, string fields)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fields = fields;
|
||||
}
|
||||
public IndexAttribute(string name, string fields, bool isUnique)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fields = fields;
|
||||
this.IsUnique = isUnique;
|
||||
}
|
||||
/// <summary>
|
||||
/// 索引名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC
|
||||
/// </summary>
|
||||
public string Fields { get; set; }
|
||||
|
||||
internal bool? _IsUnique;
|
||||
/// <summary>
|
||||
/// 是否唯一
|
||||
/// </summary>
|
||||
public bool IsUnique { get => _IsUnique ?? false; set => _IsUnique = value; }
|
||||
}
|
||||
}
|
@@ -31,34 +31,4 @@ namespace FreeSql.DataAnnotations
|
||||
internal ConcurrentDictionary<string, NavigateAttribute> _navigates { get; } = new ConcurrentDictionary<string, NavigateAttribute>(StringComparer.CurrentCultureIgnoreCase);
|
||||
internal ConcurrentDictionary<string, IndexAttribute> _indexs { get; } = new ConcurrentDictionary<string, IndexAttribute>(StringComparer.CurrentCultureIgnoreCase);
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
|
||||
public class IndexAttribute : Attribute
|
||||
{
|
||||
public IndexAttribute(string name, string fields)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fields = fields;
|
||||
}
|
||||
public IndexAttribute(string name, string fields, bool isUnique)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Fields = fields;
|
||||
this.IsUnique = isUnique;
|
||||
}
|
||||
/// <summary>
|
||||
/// 索引名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC
|
||||
/// </summary>
|
||||
public string Fields { get; set; }
|
||||
|
||||
internal bool? _IsUnique;
|
||||
/// <summary>
|
||||
/// 是否唯一
|
||||
/// </summary>
|
||||
public bool IsUnique { get => _IsUnique ?? false; set => _IsUnique = value; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user