Class IndexAttribute
索引设置,如:[Index("{tablename}_idx_01", "name")]
Inheritance
System.Object
System.Attribute
IndexAttribute
Inherited Members
System.Attribute.Equals(System.Object)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefaultAttribute()
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Attribute.TypeId
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: FreeSql.DataAnnotations
Assembly: FreeSql.dll
Syntax
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class IndexAttribute : Attribute
Constructors
| Improve this Doc View SourceIndexAttribute(String, String)
索引设置,如:[Index("{tablename}_idx_01", "name")]
Declaration
public IndexAttribute(string name, string fields)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | 索引名 v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题) |
| System.String | fields | 索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC |
IndexAttribute(String, String, Boolean)
索引设置,如:[Index("{tablename}_idx_01", "name", true)]
Declaration
public IndexAttribute(string name, string fields, bool isUnique)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | 索引名 v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题) |
| System.String | fields | 索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC |
| System.Boolean | isUnique | 是否唯一 |
Properties
| Improve this Doc View SourceFields
索引字段,为属性名以逗号分隔,如:Create_time ASC, Title ASC
Declaration
public string Fields { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
IndexMethod
索引类型
暂时只有 FreeSql.Provider.PostgreSQL 有效
Declaration
public IndexMethod IndexMethod { get; set; }
Property Value
| Type | Description |
|---|---|
| IndexMethod |
IsUnique
是否唯一
Declaration
public bool IsUnique { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Name
索引名
v1.7.0 增加占位符 {TableName} 表名区分索引名 (解决 AsTable 分表 CodeFirst 导致索引名重复的问题)
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |