Skip to content

Fast.SqlSugar public API ​

Targets: net8.0;net9.0;net10.0. Select a type in the page outline to find its declaration and members. See the module guide for configuration, examples, and constraints.

Reference version 3.5.76. Source commit a8bd407bf5f6b811da7fb7bd1db827f4da119a94.

Fast.SqlSugar.SugarDbTypeAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
[AttributeUsage(AttributeTargets.Class)]
public class SugarDbTypeAttribute : Attribute

SqlSugar database type

Remarks: Apply to a class; accepts an object that can be interpreted by ISqlSugarEntityHandler

Fast.SqlSugar.SugarDbTypeAttribute.Type ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public object Type { get; set; }

Entity database type

Remarks: null denotes the default database

Fast.SqlSugar.SugarDbTypeAttribute.SugarDbTypeAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public SugarDbTypeAttribute()

SqlSugar database type

Remarks: Apply to a class; accepts an object that can be interpreted by ISqlSugarEntityHandler

Fast.SqlSugar.SugarDbTypeAttribute.SugarDbTypeAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public SugarDbTypeAttribute(object type)

SqlSugar database type

Remarks: Apply to a class; accepts an object that can be interpreted by ISqlSugarEntityHandler

  • Parameter type: Entity database type

Fast.SqlSugar.SugarSearchTimeAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
[AttributeUsage(AttributeTargets.Property)]
public class SugarSearchTimeAttribute : Attribute

SqlSugar paginated-search time column

Remarks: Supports only DateTime

Fast.SqlSugar.SugarSearchValueAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
[AttributeUsage(AttributeTargets.Property)]
public class SugarSearchValueAttribute : Attribute

SqlSugar paginated-search column

Fast.SqlSugar.BaseEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class BaseEntity : IBaseEntity

Entity base class

Fast.SqlSugar.BaseEntity.CreatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "创建者用户Id", CreateTableFieldSort = 991)]
    public virtual long? CreatedUserId { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseEntity.CreatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "创建者用户名称", Length = 20, IsNullable = true, CreateTableFieldSort = 992)]
    public virtual string CreatedUserName { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseEntity.CreatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Required]
    [SugarColumn(ColumnDescription = "创建时间", CreateTableFieldSort = 993)]
    public virtual DateTime? CreatedTime { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseEntity.UpdatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "更新者用户Id", CreateTableFieldSort = 994)]
    public virtual long? UpdatedUserId { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseEntity.UpdatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "更新者用户名称", Length = 20, IsNullable = true, CreateTableFieldSort = 995)]
    public virtual string UpdatedUserName { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseEntity.UpdatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "更新时间", CreateTableFieldSort = 996)]
    public virtual DateTime? UpdatedTime { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class BaseRecordEntity : IBaseRecordEntity

Record entity base class

Fast.SqlSugar.BaseRecordEntity.Device ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "设备", Length = 50, IsNullable = true, CreateTableFieldSort = 971)]
    public virtual string Device { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.OS ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "操作系统(版本)", Length = 50, IsNullable = true, CreateTableFieldSort = 972)]
    public virtual string OS { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.Browser ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "浏览器(版本)", Length = 50, IsNullable = true, CreateTableFieldSort = 973)]
    public virtual string Browser { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.Province ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "省份", Length = 20, IsNullable = true, CreateTableFieldSort = 974)]
    public virtual string Province { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.City ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "城市", Length = 20, IsNullable = true, CreateTableFieldSort = 975)]
    public virtual string City { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.Ip ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "Ip", Length = 15, IsNullable = true, CreateTableFieldSort = 976)]
    public virtual string Ip { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.CreatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "创建者用户Id", CreateTableFieldSort = 991)]
    public virtual long? CreatedUserId { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.CreatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "创建者用户名称", Length = 20, IsNullable = true, CreateTableFieldSort = 992)]
    public virtual string CreatedUserName { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.CreatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Required]
    [SugarColumn(ColumnDescription = "创建时间", CreateTableFieldSort = 993)]
    public virtual DateTime? CreatedTime { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseRecordEntity.RecordCreate ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public void RecordCreate(HttpContext httpContext)

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.BaseTEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class BaseTEntity : BaseEntity, IBaseTEntity

Tenant entity base class

Fast.SqlSugar.BaseTEntity.TenantId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SugarColumn(ColumnDescription = "租户Id", CreateTableFieldSort = 997)]
    public virtual long TenantId { get; set; }

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.PagedInput ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class PagedInput

Unified SqlSugar pagination input

Fast.SqlSugar.PagedInput.PageIndex ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int PageIndex { get; set; } = 1;

Current page index; defaults to 1

Fast.SqlSugar.PagedInput.PageSize ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int PageSize { get; set; } = 20;

Page size

Fast.SqlSugar.PagedInput.SearchValue ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string SearchValue { get; set; }

Search value

Fast.SqlSugar.PagedInput.SearchTimeList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual IList<DateTime?> SearchTimeList { get; set; } = [];

Search time

Fast.SqlSugar.PagedInput.SearchList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual PagedSearchInput[] SearchList { get; set; } = [];

Search conditions

Fast.SqlSugar.PagedInput.SortList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual PagedSortInput[] SortList { get; set; } = [];

Sort conditions

Fast.SqlSugar.PagedInput.EnablePaged ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual bool EnablePaged { get; set; } = true;

Enable pagination

Remarks: Enabled by default

Fast.SqlSugar.PagedInput.IsOrderBy ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public bool IsOrderBy { get; }

Whether default sorting is allowed

Fast.SqlSugar.PagedOutput ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class PagedOutput

Unified SqlSugar pagination output

Fast.SqlSugar.PagedOutput.CreatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string CreatedUserName { get; set; }

Creator username

Fast.SqlSugar.PagedOutput.CreatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual DateTime? CreatedTime { get; set; }

Creation time

Fast.SqlSugar.PagedOutput.UpdatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string UpdatedUserName { get; set; }

Last updater username

Fast.SqlSugar.PagedOutput.UpdatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual DateTime? UpdatedTime { get; set; }

Last update time

Fast.SqlSugar.PagedOutput.RowVersion ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual long RowVersion { get; set; }

Update version control field

Fast.SqlSugar.PagedResult ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class PagedResult<TResult>

Unified SqlSugar paginated result class

  • Type parameter TResult: Operation result type

Fast.SqlSugar.PagedResult.PageIndex ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int PageIndex { get; set; }

Current page

Fast.SqlSugar.PagedResult.PageSize ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int PageSize { get; set; }

Current page number

Fast.SqlSugar.PagedResult.TotalPage ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int TotalPage { get; set; }

Total page count

Fast.SqlSugar.PagedResult.TotalRows ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual int TotalRows { get; set; }

Total record count

Fast.SqlSugar.PagedResult.Rows ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual IEnumerable<TResult> Rows { get; set; }

Data

Fast.SqlSugar.PagedResult.HasPrevPages ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual bool HasPrevPages { get; set; }

Whether a previous page exists

Fast.SqlSugar.PagedResult.HasNextPages ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual bool HasNextPages { get; set; }

Whether a next page exists

Fast.SqlSugar.PagedResult.AssemblyName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string AssemblyName { get; set; }

Assembly name

Fast.SqlSugar.PagedResult.TypeFullName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string TypeFullName { get; set; }

Fully qualified type name

Fast.SqlSugar.PagedSearchInput ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class PagedSearchInput

Unified SqlSugar paginated-search input

Fast.SqlSugar.PagedSearchInput.EnField ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[StringRequired(ErrorMessage = "搜索字段不能为空")]
    public virtual string EnField { get; set; }

Search field name in English

Remarks: Primary field used to generate the query

Fast.SqlSugar.PagedSearchInput.ChField ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string ChField { get; set; }

Search field name in Chinese

Remarks: Secondary field used for display messages

Fast.SqlSugar.PagedSearchInput.Value ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string Value { get; set; }

Search value

Fast.SqlSugar.PagedSearchInput.Type ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual PagedSearchTypeEnum Type { get; set; } = PagedSearchTypeEnum.Like;

Search type

Remarks: Fuzzy matching by default

Fast.SqlSugar.PagedSortInput ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class PagedSortInput

Unified SqlSugar pagination sort input

Fast.SqlSugar.PagedSortInput.EnField ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[StringRequired(ErrorMessage = "排序字段不能为空")]
    public virtual string EnField { get; set; }

Sort field name in English

Remarks: Primary field used to generate the sort clause

Fast.SqlSugar.PagedSortInput.ChField ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string ChField { get; set; }

Sort field name in Chinese

Remarks: Secondary field used for display messages

Fast.SqlSugar.PagedSortInput.Mode ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string Mode { get; set; }

Sort direction

Remarks: Element Plus table sort direction: ascending or descending; an empty value defaults to ascending

Fast.SqlSugar.PagedSortInput.IsDescending ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual bool IsDescending { get; }

Whether to sort descending

Fast.SqlSugar.SlaveConnectionInfo ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class SlaveConnectionInfo

Replica connection information

Remarks: Connection fields are configured independently, without inheriting primary settings or automatically running post-configuration.

Fast.SqlSugar.SlaveConnectionInfo.ServiceIp ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string ServiceIp { get; set; }

Server IP address

Fast.SqlSugar.SlaveConnectionInfo.Port ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? Port { get; set; }

Port number

Fast.SqlSugar.SlaveConnectionInfo.DbName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbName { get; set; }

Database name

Fast.SqlSugar.SlaveConnectionInfo.DbUser ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbUser { get; set; }

Database user

Fast.SqlSugar.SlaveConnectionInfo.DbPwd ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbPwd { get; set; }

Database password

Fast.SqlSugar.SlaveConnectionInfo.MaxPoolSize ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? MaxPoolSize { get; set; }

Maximum connection pool size

Remarks: Automatically generated MySql, MySqlConnector, SqlServer and PostgreSQL connection strings use this value, defaulting to 100 when unspecified.

Fast.SqlSugar.SlaveConnectionInfo.CommandTimeOut ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? CommandTimeOut { get; set; }

Timeout in seconds

Remarks: The current connection-configuration pipeline does not apply this field as a separate replica command timeout.

Fast.SqlSugar.SlaveConnectionInfo.HitRate ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int HitRate { get; set; }

Replica selection weight

Remarks: Zero means never selected; a total weight of at most 10 is recommended

Fast.SqlSugar.SqlSugarEntityInfo ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public sealed class SqlSugarEntityInfo

SqlSugar entity information

Fast.SqlSugar.SqlSugarEntityInfo.TableName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string TableName { get; set; }

Database table name

Fast.SqlSugar.SqlSugarEntityInfo.TableDescription ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string TableDescription { get; set; }

Database table description

Fast.SqlSugar.SqlSugarEntityInfo.EntityType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public Type EntityType { get; set; }

Entity type

Fast.SqlSugar.SqlSugarEntityInfo.IsSplitTable ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public bool IsSplitTable { get; set; }

Whether the table is partitioned

Fast.SqlSugar.SqlSugarEntityInfo.SugarDbType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public object SugarDbType { get; set; }

Type property of SugarDbTypeAttribute

Fast.SqlSugar.UpdateVersionInput ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class UpdateVersionInput

Row-version update input

Fast.SqlSugar.UpdateVersionInput.RowVersion ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[LongRequired(ErrorMessage = "更新版本控制字段不能为空", AllowZero = true)]
    public long RowVersion { get; set; }

Update version control field

Fast.SqlSugar.SqlSugarContext ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public sealed class SqlSugarContext

SqlSugar context

Fast.SqlSugar.SqlSugarContext.ConnectionSettings ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static ConnectionSettingsOptions ConnectionSettings { get; internal set; }

Connection string settings

Fast.SqlSugar.SqlSugarContext.SnowflakeSettings ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static SnowflakeSettingsOptions SnowflakeSettings { get; internal set; }

Snowflake ID settings

Fast.SqlSugar.SqlSugarContext.MaxNotPageSize ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static int MaxNotPageSize { get; set; }

Maximum size limit for unpaginated queries

Fast.SqlSugar.SqlSugarContext.SqlSugarEntityList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static readonly List<SqlSugarEntityInfo> SqlSugarEntityList;

SqlSugar entity collection

Fast.SqlSugar.SqlSugarContext.GetConnectionConfig ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static ConnectionConfig GetConnectionConfig(ConnectionSettingsOptions connectionSettings)

Gets connection configuration

  • Parameter connectionSettings: Connection settings
  • Returns: Retrieved connection configuration

Fast.SqlSugar.PagedSearchTypeEnum ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[FastEnum("分页搜索类型枚举")]
public enum PagedSearchTypeEnum : byte

Pagination search type enum

Fast.SqlSugar.PagedSearchTypeEnum.Like ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("模糊匹配")]
    Like = 1

Fuzzy match

Fast.SqlSugar.PagedSearchTypeEnum.Equal ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("等于")]
    Equal = 2

Equal

Fast.SqlSugar.PagedSearchTypeEnum.NotEqual ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("不等于")]
    NotEqual = 3

Not equal

Fast.SqlSugar.PagedSearchTypeEnum.GreaterThan ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("大于")]
    GreaterThan = 4

Greater than

Fast.SqlSugar.PagedSearchTypeEnum.GreaterThanOrEqual ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("大于等于")]
    GreaterThanOrEqual = 5

Greater than or equal

Fast.SqlSugar.PagedSearchTypeEnum.LessThan ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("小于")]
    LessThan = 6

Less than

Fast.SqlSugar.PagedSearchTypeEnum.LessThanOrEqual ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("小于等于")]
    LessThanOrEqual = 7

Less than or equal

Fast.SqlSugar.PagedSearchTypeEnum.Include ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("包含")]
    Include = 8

Include

Fast.SqlSugar.PagedSearchTypeEnum.NotInclude ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("排除")]
    NotInclude = 9

Exclude

Fast.SqlSugar.SugarDbType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[FastEnum("Sugar数据库类型枚举")]
public enum SugarDbType

Sugar database type enum

Fast.SqlSugar.SugarDbType.MySql ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("MySql")]
    MySql = 1

MySql

Fast.SqlSugar.SugarDbType.SqlServer ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("SqlServer")]
    SqlServer = 2

SqlServer

Fast.SqlSugar.SugarDbType.Sqlite ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("SqLite")]
    Sqlite = 3

SqLite

Fast.SqlSugar.SugarDbType.Oracle ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("Oracle")]
    Oracle = 4

Oracle

Fast.SqlSugar.SugarDbType.PostgreSQL ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("PostgreSQL")]
    PostgreSQL = 5

PostgreSQL

Fast.SqlSugar.SugarDbType.MongoDb ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Description("MongoDB")]
    MongoDb = 6

MongoDB

Fast.SqlSugar.DbTypeExtension ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class DbTypeExtension

Provides extension methods for DbType

Fast.SqlSugar.DbTypeExtension.ToDbType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static DbType ToDbType(this SugarDbType sugarDbType)

Converts SugarDbType to DbType

  • Parameter sugarDbType: Sugar database type
  • Returns: Converts SugarDbType to DbType
  • Throws ArgumentOutOfRangeException: sugarDbType is not one of the six currently supported database types.

Fast.SqlSugar.DbTypeExtension.ToSugarDbType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static SugarDbType ToSugarDbType(this DbType dbType)

Converts DbType to SugarDbType

  • Parameter dbType: Database type
  • Returns: Converts DbType to SugarDbType
  • Throws ArgumentOutOfRangeException: dbType is not MySql, SqlServer, Sqlite, Oracle, PostgreSQL or MongoDb.

Fast.SqlSugar.IServiceCollectionExtension ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class IServiceCollectionExtension

Dynamic API extensions for IServiceCollection

Fast.SqlSugar.IServiceCollectionExtension.AddSnowflake ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static IServiceCollection AddSnowflake(this IServiceCollection services, IConfiguration configuration,
        string section = "SnowflakeSettings")

Adds Snowflake IDs

  • Parameter services: The service collection to add services to
  • Parameter configuration: Configuration used to read module settings
  • Parameter section: JSON configuration section key; defaults to SnowflakeSettings
  • Returns: Returns services for chaining

Fast.SqlSugar.IServiceCollectionExtension.AddSnowflake ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static IServiceCollection AddSnowflake(this IServiceCollection services, IConfiguration configuration,
        Action<SnowflakeSettingsOptions> optionAction)

Adds Snowflake IDs

  • Parameter services: The service collection to add services to
  • Parameter configuration: Configuration used to read module settings
  • Parameter optionAction: Snowflake ID configuration callback
  • Returns: Returns services for chaining

Fast.SqlSugar.IServiceCollectionExtension.AddSqlSugar ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static IServiceCollection AddSqlSugar(this IServiceCollection services, IConfiguration configuration,
        IHostEnvironment hostEnvironment, string connectionSection = "ConnectionSettings")

Registers SqlSugar services

  • Parameter services: The service collection to add services to
  • Parameter configuration: Configuration used to read module settings
  • Parameter hostEnvironment: Current application's hosting environment
  • Parameter connectionSection: JSON configuration section key; defaults to ConnectionSettings
  • Returns: Returns services for chaining

Fast.SqlSugar.IServiceCollectionExtension.AddSqlSugar ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static IServiceCollection AddSqlSugar(this IServiceCollection services, IConfiguration configuration,
        IHostEnvironment hostEnvironment, Action<ConnectionSettingsOptions> optionAction)

Registers SqlSugar services

  • Parameter services: The service collection to add services to
  • Parameter configuration: Configuration used to read module settings
  • Parameter hostEnvironment: Current application's hosting environment
  • Parameter optionAction: Database connection configuration callback
  • Returns: Returns services for chaining

Fast.SqlSugar.SqlSugarExtension ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class SqlSugarExtension

Provides SqlSugar extensions for ISqlSugarClient

Fast.SqlSugar.SqlSugarExtension.GetSugarTableName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static string GetSugarTableName(this Type type)

Gets TableName from the SugarTable attribute

  • Parameter type: Target type
  • Returns: TableName from the SugarTable attribute

Fast.SqlSugar.SqlSugarExtension.GetSugarTableAttribute ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static SugarTable GetSugarTableAttribute(this Type type)

Gets the SugarTable attribute

  • Parameter type: Target type
  • Returns: Retrieved SugarTable attribute

Fast.SqlSugar.SqlSugarExtension.ToDataTable ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static List<DataTable> ToDataTable<T>(this List<T> list)

Converts to DataTable

  • Parameter list: Collection to process
  • Type parameter T: Model type corresponding to each data table row
  • Returns: Collection converted to DataTable

Fast.SqlSugar.SqlSugarPageExtension ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class SqlSugarPageExtension

Provides ISugarQueryable pagination extensions for ISugarQueryable{T}

Fast.SqlSugar.SqlSugarPageExtension.ToPagedData ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static PagedResult<TResult> ToPagedData<TEntity, TResult>(this PagedResult<TEntity> pagedResult,
        Func<TEntity, TResult> selectExpression)

Pagination result type conversion

  • Parameter pagedResult: Paginated result to populate
  • Parameter selectExpression: Expression used to convert pagination result types
  • Type parameter TEntity: Entity type
  • Type parameter TResult: Operation result type
  • Returns: Pagination result type conversion

Fast.SqlSugar.SqlSugarPageExtension.ToPagedList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static PagedResult<TEntity> ToPagedList<TEntity>(this ISugarQueryable<TEntity> queryable, PagedInput input)

SqlSugar pagination extension

Remarks: For multi-table queries (LeftJoin/Join), pagination counts depend on MergeTable. Project to a consolidated shape before pagination using .Select((t1, t2) => new { ... }).MergeTable() or .SelectMergeTable((t1, t2) => new { ... }). Omitting MergeTable may produce incorrect counts or results

  • Parameter queryable: Query object to continue composing
  • Parameter input: PagedInput unified SqlSugar pagination input
  • Type parameter TEntity: Entity type
  • Returns: Records and pagination metadata; an unpaged result may equal the configured limit, but exceeding it throws.

Fast.SqlSugar.SqlSugarPageExtension.ToPagedListAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static async Task<PagedResult<TEntity>> ToPagedListAsync<TEntity>(this ISugarQueryable<TEntity> queryable,
        PagedInput input)

SqlSugar pagination extension

Remarks: For multi-table queries (LeftJoin/Join), pagination counts depend on MergeTable. Project to a consolidated shape before pagination using .Select((t1, t2) => new { ... }).MergeTable() or .SelectMergeTable((t1, t2) => new { ... }). Omitting MergeTable may produce incorrect counts or results

  • Parameter queryable: Query object to continue composing
  • Parameter input: PagedInput unified SqlSugar pagination input
  • Type parameter TEntity: Entity type
  • Returns: A task containing records and pagination metadata; unpaged results exceeding the configured limit throw.

Fast.SqlSugar.SqlSugarPageExtension.ToPagedList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static PagedResult<TEntity> ToPagedList<TEntity>(this ISugarQueryable<TEntity> queryable, int pageIndex,
        int pageSize = 20, bool enablePaged = true)

SqlSugar pagination extension

  • Parameter queryable: Query object to continue composing
  • Parameter pageIndex: Page number, starting at 1
  • Parameter pageSize: Records per page
  • Parameter enablePaged: Whether to enable paginated queries
  • Type parameter TEntity: Entity type
  • Returns: Records and pagination metadata; an unpaged result may equal the configured limit, but exceeding it throws.

Fast.SqlSugar.SqlSugarPageExtension.ToPagedListAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static async Task<PagedResult<TEntity>> ToPagedListAsync<TEntity>(this ISugarQueryable<TEntity> queryable,
        int pageIndex, int pageSize = 20, bool enablePaged = true)

SqlSugar pagination extension

  • Parameter queryable: Query object to continue composing
  • Parameter pageIndex: Page number, starting at 1
  • Parameter pageSize: Records per page
  • Parameter enablePaged: Whether to enable paginated queries
  • Type parameter TEntity: Entity type
  • Returns: A task containing records and pagination metadata; unpaged results exceeding the configured limit throw.

Fast.SqlSugar.SqlSugarPageExtension.SugarPaged ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static ISugarQueryable<TEntity> SugarPaged<TEntity>(this ISugarQueryable<TEntity> queryable, PagedInput input)

Unified Sugar pagination processing

Remarks: Supports multiple databases

  • Parameter queryable: Query object to continue composing
  • Parameter input: Method input data
  • Type parameter TEntity: Entity type
  • Returns: Unified Sugar pagination processing

Fast.SqlSugar.SugarEntityFilter ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public static class SugarEntityFilter

Sugar entity filter

Fast.SqlSugar.SugarEntityFilter.LoadSugarAop ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static void LoadSugarAop(bool isDevelopment, ISqlSugarClient _db, int? sugarSqlExecMaxSeconds = null,
        bool diffLog = false, bool disableAop = true, ISqlSugarEntityHandler sqlSugarEntityHandler = null)

Loads Sugar AOP

  • Parameter isDevelopment: Whether the current environment is Development
  • Parameter _db: SqlSugar client used by the current repository
  • Parameter sugarSqlExecMaxSeconds: SQL execution time warning threshold in seconds
  • Parameter diffLog: Whether to record differences before and after data changes
  • Parameter disableAop: Whether to disable SqlSugar AOP callbacks
  • Parameter sqlSugarEntityHandler: Extension handler for processing before and after entity persistence

Fast.SqlSugar.SugarEntityFilter.LoadSugarFilter ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public static void LoadSugarFilter(ISqlSugarClient _db, ISqlSugarEntityHandler sqlSugarEntityHandler)

Loads Sugar filters

  • Parameter _db: SqlSugar client used by the current repository
  • Parameter sqlSugarEntityHandler: Extension handler for processing before and after entity persistence

Fast.SqlSugar.ISqlSugarEntityHandler ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public interface ISqlSugarEntityHandler

Defines the SqlSugar entity auditing, tenancy, and SQL event handling contract

Remarks: The implementation constructor must not inject ISqlSugarClient, which would create a circular dependency. It must not inject IHttpContextAccessor or HttpContext, as the handler may outlive a request and access disposed request resources

Fast.SqlSugar.ISqlSugarEntityHandler.GetConnectionSettings ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<ConnectionSettingsOptions> GetConnectionSettings<TEntity>(ISqlSugarClient sqlSugarClient,
        SugarDbTypeAttribute sugarDbType, Type entityType);

Asynchronously gets the database connection settings for an entity

  • Parameter sqlSugarClient: SqlSugar client instance
  • Parameter sugarDbType: Database-type attribute declared on the entity; null when absent
  • Parameter entityType: Current entity type
  • Type parameter TEntity: Entity type
  • Returns: Entity database connection settings; returning null selects the global defaults

Fast.SqlSugar.ISqlSugarEntityHandler.ExecuteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task ExecuteAsync(string rawSql, SugarParameter[] parameters, TimeSpan executeTime, string handlerSql);

Asynchronously handles an executed SQL statement

  • Parameter rawSql: Original SQL text
  • Parameter parameters: Parameters used by the method or query
  • Parameter executeTime: Elapsed operation time
  • Parameter handlerSql: SQL text to inspect or rewrite
  • Returns: A task representing SQL handling

Fast.SqlSugar.ISqlSugarEntityHandler.ExecuteTimeoutAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task ExecuteTimeoutAsync(string fileName, int fileLine, string methodName, string rawSql, SugarParameter[] parameters,
        TimeSpan executeTime, string handlerSql, string message);

Asynchronously handles a SQL statement exceeding the execution-time threshold

  • Parameter fileName: Source filename
  • Parameter fileLine: Source line number
  • Parameter methodName: Target method name
  • Parameter rawSql: Original SQL text
  • Parameter parameters: Parameters used by the method or query
  • Parameter executeTime: Elapsed operation time
  • Parameter handlerSql: SQL text to inspect or rewrite
  • Parameter message: Message to record or return
  • Returns: A task representing SQL timeout handling

Fast.SqlSugar.ISqlSugarEntityHandler.ExecuteDiffLogAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task ExecuteDiffLogAsync(DiffType diffType, string tableName, string tableDescription, object businessData,
        List<List<DiffLogColumnInfo>> beforeColumnList, List<List<DiffLogColumnInfo>> afterColumnList, string rawSql,
        SugarParameter[] parameters, TimeSpan? executeTime, string handlerSql);

Asynchronously records SQL data-change differences

  • Parameter diffType: Data change type
  • Parameter tableName: Database table name
  • Parameter tableDescription: Database table description
  • Parameter businessData: Business data carried in the response
  • Parameter beforeColumnList: Column values before the change
  • Parameter afterColumnList: Column values after the change
  • Parameter rawSql: Original SQL text
  • Parameter parameters: Parameters used by the method or query
  • Parameter executeTime: Elapsed operation time
  • Parameter handlerSql: SQL text to inspect or rewrite
  • Returns: A task representing data-change difference recording

Fast.SqlSugar.ISqlSugarEntityHandler.ExecuteErrorAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task ExecuteErrorAsync(string fileName, int fileLine, string methodName, string rawSql, SugarParameter[] parameters,
        string handlerSql, SqlSugarException exception);

Asynchronously handles a SQL execution exception

  • Parameter fileName: Source filename
  • Parameter fileLine: Source line number
  • Parameter methodName: Target method name
  • Parameter rawSql: Original SQL text
  • Parameter parameters: Parameters used by the method or query
  • Parameter handlerSql: SQL text to inspect or rewrite
  • Parameter exception: Exception raised during SQL execution
  • Returns: A task representing SQL exception handling

Fast.SqlSugar.ISqlSugarEntityHandler.IsSuperAdmin ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool IsSuperAdmin();

Whether the user is a super administrator

  • Returns: Returns true when the condition is met; otherwise false

Fast.SqlSugar.ISqlSugarEntityHandler.IsAdmin ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool IsAdmin();

Whether the user is an administrator

  • Returns: Returns true when the condition is met; otherwise false

Fast.SqlSugar.ISqlSugarEntityHandler.AssignTenantId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? AssignTenantId();

Gets the tenant ID for a new entity

  • Returns: Tenant ID, or null when undetermined

Fast.SqlSugar.ISqlSugarEntityHandler.AssignDepartmentId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? AssignDepartmentId();

Gets the department ID for a new entity

  • Returns: Department ID, or null when undetermined

Fast.SqlSugar.ISqlSugarEntityHandler.AssignDepartmentName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string AssignDepartmentName();

Gets the department name for a new entity

  • Returns: Department name, or null when undetermined

Fast.SqlSugar.ISqlSugarEntityHandler.AssignUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? AssignUserId();

Gets the user ID for a new entity

  • Returns: User ID, or null when undetermined

Fast.SqlSugar.ISqlSugarEntityHandler.AssignUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string AssignUserName();

Gets the username for a new entity

  • Returns: Username, or null when undetermined

Fast.SqlSugar.IBaseEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IBaseEntity : IDatabaseEntity

Base entity interface

Fast.SqlSugar.IBaseEntity.CreatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? CreatedUserId { get; set; }

Creator user ID

Fast.SqlSugar.IBaseEntity.CreatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string CreatedUserName { get; set; }

Creator username

Fast.SqlSugar.IBaseEntity.CreatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
DateTime? CreatedTime { get; set; }

Creation time

Fast.SqlSugar.IBaseEntity.UpdatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? UpdatedUserId { get; set; }

Last updater user ID

Fast.SqlSugar.IBaseEntity.UpdatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string UpdatedUserName { get; set; }

Last updater username

Fast.SqlSugar.IBaseEntity.UpdatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
DateTime? UpdatedTime { get; set; }

Last update time

Fast.SqlSugar.IBaseRecordEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IBaseRecordEntity : IDatabaseEntity

Base record entity interface with an auto-incrementing primary key

Fast.SqlSugar.IBaseRecordEntity.Device ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string Device { get; set; }

Device

Fast.SqlSugar.IBaseRecordEntity.OS ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string OS { get; set; }

Operating system and version

Fast.SqlSugar.IBaseRecordEntity.Browser ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string Browser { get; set; }

Browser and version

Fast.SqlSugar.IBaseRecordEntity.Province ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string Province { get; set; }

Province

Fast.SqlSugar.IBaseRecordEntity.City ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string City { get; set; }

City

Fast.SqlSugar.IBaseRecordEntity.Ip ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string Ip { get; set; }

Ip

Fast.SqlSugar.IBaseRecordEntity.CreatedUserId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? CreatedUserId { get; set; }

Creator user ID

Fast.SqlSugar.IBaseRecordEntity.CreatedUserName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string CreatedUserName { get; set; }

Creator username

Fast.SqlSugar.IBaseRecordEntity.CreatedTime ​

Source · Targets: net8.0, net9.0, net10.0

csharp
DateTime? CreatedTime { get; set; }

Creation time

Fast.SqlSugar.IBaseRecordEntity.RecordCreate ​

Source · Targets: net8.0, net9.0, net10.0

csharp
void RecordCreate(HttpContext httpContext);

Record creation

  • Parameter httpContext: Current request context; may be null outside a request

Fast.SqlSugar.IBaseTEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IBaseTEntity : IDatabaseEntity

Base tenant entity interface

Fast.SqlSugar.IBaseTEntity.TenantId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long TenantId { get; set; }

Tenant ID

Fast.SqlSugar.IDatabaseEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IDatabaseEntity

Entity interface

Fast.SqlSugar.IDeletedEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IDeletedEntity : IDatabaseEntity

Soft-delete entity interface

Fast.SqlSugar.IDeletedEntity.IsDeleted ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool IsDeleted { get; set; }

Soft-delete flag

Fast.SqlSugar.IDepartmentEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IDepartmentEntity : IDatabaseEntity

Department entity interface

Fast.SqlSugar.IDepartmentEntity.DepartmentId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long? DepartmentId { get; set; }

Department ID

Fast.SqlSugar.IDepartmentEntity.DepartmentName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
string DepartmentName { get; set; }

Department name

Fast.SqlSugar.IUpdateVersion ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public interface IUpdateVersion : IDatabaseEntity

Row-version entity interface

Remarks: Only single-entity updates check the row version; conflicts throw VersionExceptions

Fast.SqlSugar.IUpdateVersion.RowVersion ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long RowVersion { get; set; }

Update version control field

Fast.SqlSugar.ConnectionSettingsOptions ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class ConnectionSettingsOptions : IPostConfigure

Connection string settings

Fast.SqlSugar.ConnectionSettingsOptions.ConnectionId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string ConnectionId { get; set; }

SqlSugarClient connection ID

Fast.SqlSugar.ConnectionSettingsOptions.DbType ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public DbType? DbType { get; set; }

Database type identifying which database is used

Fast.SqlSugar.ConnectionSettingsOptions.ServiceIp ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string ServiceIp { get; set; }

Server IP address

Fast.SqlSugar.ConnectionSettingsOptions.Port ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? Port { get; set; }

Port number

Remarks: Common ports: MySql 3306, SqlServer 1433, Oracle 1521, PostgreSQL 5432 and MongoDb 27017. PostConfigure sets an unspecified port to 1433 without selecting a port by database type.

Fast.SqlSugar.ConnectionSettingsOptions.DbName ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbName { get; set; }

Database name

Fast.SqlSugar.ConnectionSettingsOptions.DbUser ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbUser { get; set; }

Database user

Fast.SqlSugar.ConnectionSettingsOptions.DbPwd ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public string DbPwd { get; set; }

Database password

Fast.SqlSugar.ConnectionSettingsOptions.MaxPoolSize ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? MaxPoolSize { get; set; }

Maximum connection pool size

Remarks: PostConfigure defaults this value to 100. Automatically generated MySql, MySqlConnector, SqlServer and PostgreSQL connection strings use it. With CustomConnectionStr, configure pooling in the custom connection string.

Fast.SqlSugar.ConnectionSettingsOptions.CommandTimeOut ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? CommandTimeOut { get; set; }

Timeout in seconds

Fast.SqlSugar.ConnectionSettingsOptions.SugarSqlExecMaxSeconds ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public int? SugarSqlExecMaxSeconds { get; set; }

Maximum SQL execution time in seconds before SqlSugar records a warning

Fast.SqlSugar.ConnectionSettingsOptions.DiffLog ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public bool? DiffLog { get; set; }

Difference logging

Fast.SqlSugar.ConnectionSettingsOptions.DisableAop ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public bool? DisableAop { get; set; }

Disable SqlSugar AOP

Remarks: If ISqlSugarEntityHandler persists logs to a database, place AOP log tables in a separate database with AOP disabled, or persist through a new SqlSugarClient instance. Otherwise recursive logging can cause an infinite loop

Fast.SqlSugar.ConnectionSettingsOptions.CustomConnectionStr ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public virtual string CustomConnectionStr { get; set; }

Custom connection string

Remarks: A nonblank value is used directly and causes SlaveConnectionList to be ignored. Server, port, database, credential and pool fields are not used to construct the primary connection string.

Fast.SqlSugar.ConnectionSettingsOptions.SlaveConnectionList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public List<SlaveConnectionInfo> SlaveConnectionList { get; set; }

Replica information

Remarks: Replicas are generally not recommended for the default or primary database

Fast.SqlSugar.ConnectionSettingsOptions.PostConfigure ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public void PostConfigure()

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.SnowflakeSettingsOptions ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[SuppressSniffer]
public class SnowflakeSettingsOptions : IPostConfigure

Snowflake ID settings

Fast.SqlSugar.SnowflakeSettingsOptions.WorkerId ​

Source · Targets: net8.0, net9.0, net10.0

csharp
[Required]
    public ushort? WorkerId { get; set; }

Worker ID

Fast.SqlSugar.SnowflakeSettingsOptions.PostConfigure ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public void PostConfigure()

Documentation is inherited from an interface or base class; consult that declaration.

Fast.SqlSugar.ISqlSugarRepository ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public partial interface ISqlSugarRepository<TEntity> : ISqlSugarClient where TEntity : class, new()

SqlSugar repository interface

Fast.SqlSugar.ISqlSugarRepository.SupportsLogicDelete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool SupportsLogicDelete { get; }

Whether logical deletion is supported

Remarks: Effective only when TEntity implements IDeletedEntity

Fast.SqlSugar.ISqlSugarRepository.SupportsRowVersion ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool SupportsRowVersion { get; }

Whether row-version optimistic concurrency is supported

Remarks: Effective only when TEntity implements IUpdateVersion

Fast.SqlSugar.ISqlSugarRepository.IsSplitTable ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool IsSplitTable { get; }

Whether the table is partitioned

Remarks: Effective only when TEntity is decorated with SplitTableAttribute

Fast.SqlSugar.ISqlSugarRepository.DatabaseInfo ​

Source · Targets: net8.0, net9.0, net10.0

csharp
ConnectionSettingsOptions DatabaseInfo { get; }

Database information for the current repository

Fast.SqlSugar.ISqlSugarRepository.Change ​

Source · Targets: net8.0, net9.0, net10.0

csharp
ISqlSugarRepository<TChangeEntity> Change<TChangeEntity>() where TChangeEntity : class, new();

Switches repository or tenant repository

  • Type parameter TChangeEntity: Entity type to use temporarily
  • Returns: Switches repository or tenant repository

Fast.SqlSugar.ISqlSugarRepository ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public partial interface ISqlSugarRepository<TEntity>

SqlSugar delete repository interface

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(TEntity entity);

Deletes one record

  • Parameter entity: Entity to process
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(TEntity entity);

Deletes one record

  • Parameter entity: Entity to process
  • Returns: A task whose result is the number of records actually deleted

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(object key);

Deletes one record

  • Parameter key: Primary key of the entity to delete
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(object key);

Deletes one record

  • Parameter key: Primary key of the entity to delete
  • Returns: A task whose result is the number of records actually deleted

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(params object[] keys);

Deletes multiple records

  • Parameter keys: Keys used to locate target records
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(params object[] keys);

Deletes multiple records

  • Parameter keys: Keys used to locate target records
  • Returns: A task whose result is the number of records actually deleted in the batch

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(params TEntity[] entities);

Deletes multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(params TEntity[] entities);

Deletes multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task whose result is the number of records actually deleted in the batch

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(IEnumerable<TEntity> entities);

Deletes multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(IEnumerable<TEntity> entities);

Deletes multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task whose result is the number of records actually deleted in the batch

Fast.SqlSugar.ISqlSugarRepository.Delete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Delete(Expression<Func<TEntity, bool>> whereExpression);

Deletes records matching a custom condition

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: The number of entries actually deleted

Fast.SqlSugar.ISqlSugarRepository.DeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> DeleteAsync(Expression<Func<TEntity, bool>> whereExpression);

Deletes records matching a custom condition

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task whose result is the number of matching records actually deleted

Fast.SqlSugar.ISqlSugarRepository.LogicDelete ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int LogicDelete(Expression<Func<TEntity, bool>> whereExpression);

Logically deletes records matching a custom condition

Remarks: The entity must implement IDeletedEntity

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Logically deletes records matching a custom condition

Fast.SqlSugar.ISqlSugarRepository.LogicDeleteAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> LogicDeleteAsync(Expression<Func<TEntity, bool>> whereExpression);

Logically deletes records matching a custom condition

Remarks: The entity must implement IDeletedEntity

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task representing logical deletion by a custom condition

Fast.SqlSugar.ISqlSugarRepository ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public partial interface ISqlSugarRepository<TEntity>

SqlSugar insert repository interface

Fast.SqlSugar.ISqlSugarRepository.Insert ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Insert(TEntity entity);

Inserts one record

  • Parameter entity: Entity to process
  • Returns: Inserts one record

Fast.SqlSugar.ISqlSugarRepository.InsertAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> InsertAsync(TEntity entity);

Inserts one record

  • Parameter entity: Entity to process
  • Returns: A task representing insertion of one record

Fast.SqlSugar.ISqlSugarRepository.Insert ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Insert(params TEntity[] entities);

Inserts multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: Inserts multiple records

Fast.SqlSugar.ISqlSugarRepository.InsertAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> InsertAsync(params TEntity[] entities);

Inserts multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task representing insertion of multiple records

Fast.SqlSugar.ISqlSugarRepository.Insert ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Insert(IEnumerable<TEntity> entities);

Inserts multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: Inserts multiple records

Fast.SqlSugar.ISqlSugarRepository.InsertAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> InsertAsync(IEnumerable<TEntity> entities);

Inserts multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task representing insertion of multiple records

Fast.SqlSugar.ISqlSugarRepository.InsertReturnIdentity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int InsertReturnIdentity(TEntity entity);

Inserts one record and returns its auto-incrementing ID

  • Parameter entity: Entity to process
  • Returns: Inserts one record and returns its auto-incrementing ID

Fast.SqlSugar.ISqlSugarRepository.InsertReturnIdentityAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> InsertReturnIdentityAsync(TEntity entity);

Inserts one record and returns its auto-incrementing ID

  • Parameter entity: Entity to process
  • Returns: A task whose result is the inserted record's auto-incrementing ID

Fast.SqlSugar.ISqlSugarRepository.ExecuteReturnBigIdentity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
long ExecuteReturnBigIdentity(TEntity entity);

Inserts one record and returns its auto-incrementing ID as long

  • Parameter entity: Entity to process
  • Returns: Inserts one record and returns its auto-incrementing ID as long

Fast.SqlSugar.ISqlSugarRepository.ExecuteReturnBigIdentityAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<long> ExecuteReturnBigIdentityAsync(TEntity entity);

Inserts one record and returns its auto-incrementing ID as long

  • Parameter entity: Entity to process
  • Returns: A task whose result is the inserted record's auto-incrementing long ID

Fast.SqlSugar.ISqlSugarRepository.InsertReturnEntity ​

Source · Targets: net8.0, net9.0, net10.0

csharp
TEntity InsertReturnEntity(TEntity entity);

Inserts one record and returns the inserted data

  • Parameter entity: Entity to process
  • Returns: Inserts one record and returns the inserted data

Fast.SqlSugar.ISqlSugarRepository.InsertReturnEntityAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<TEntity> InsertReturnEntityAsync(TEntity entity);

Inserts one record and returns the inserted data

  • Parameter entity: Entity to process
  • Returns: A task whose result is the inserted data

Fast.SqlSugar.ISqlSugarRepository ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public partial interface ISqlSugarRepository<TEntity>

SqlSugar query repository interface

Fast.SqlSugar.ISqlSugarRepository.Count ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Count(Expression<Func<TEntity, bool>> whereExpression = null);

Gets the total count

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Number of matching items

Fast.SqlSugar.ISqlSugarRepository.CountAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression = null);

Gets the total count

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task whose result is the number of matching records

Fast.SqlSugar.ISqlSugarRepository.Any ​

Source · Targets: net8.0, net9.0, net10.0

csharp
bool Any(Expression<Func<TEntity, bool>> whereExpression);

Checks whether a record exists

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Returns true when the condition is met; otherwise false

Fast.SqlSugar.ISqlSugarRepository.AnyAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> whereExpression);

Checks whether a record exists

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Returns true when the condition is met; otherwise false

Fast.SqlSugar.ISqlSugarRepository.SingleOrDefault ​

Source · Targets: net8.0, net9.0, net10.0

csharp
TEntity SingleOrDefault(object Id);

Gets an entity by its primary key

  • Parameter Id: Unique identifier
  • Returns: Gets an entity by its primary key

Fast.SqlSugar.ISqlSugarRepository.SingleOrDefaultAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<TEntity> SingleOrDefaultAsync(object Id);

Gets an entity by its primary key

  • Parameter Id: Unique identifier
  • Returns: A task whose result is the entity matching the primary key

Fast.SqlSugar.ISqlSugarRepository.SingleOrDefault ​

Source · Targets: net8.0, net9.0, net10.0

csharp
TEntity SingleOrDefault(Expression<Func<TEntity, bool>> whereExpression);

Gets an entity by a condition

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Gets an entity by a condition

Fast.SqlSugar.ISqlSugarRepository.SingleOrDefaultAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity, bool>> whereExpression);

Gets an entity by a condition

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task whose result is the entity matching the condition

Fast.SqlSugar.ISqlSugarRepository.FirstOrDefault ​

Source · Targets: net8.0, net9.0, net10.0

csharp
TEntity FirstOrDefault(Expression<Func<TEntity, bool>> whereExpression);

Gets one entity

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Retrieved entity

Fast.SqlSugar.ISqlSugarRepository.FirstOrDefaultAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> whereExpression);

Gets one entity

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task whose result is the retrieved entity

Fast.SqlSugar.ISqlSugarRepository.ToList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
List<TEntity> ToList();

Gets a list

  • Returns: Retrieved list

Fast.SqlSugar.ISqlSugarRepository.ToListAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<List<TEntity>> ToListAsync();

Gets a list

  • Returns: A task whose result is the retrieved list

Fast.SqlSugar.ISqlSugarRepository.ToList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
List<TEntity> ToList(Expression<Func<TEntity, bool>> whereExpression);

Gets a list

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: Retrieved list

Fast.SqlSugar.ISqlSugarRepository.ToListAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<List<TEntity>> ToListAsync(Expression<Func<TEntity, bool>> whereExpression);

Gets a list

  • Parameter whereExpression: Condition expression used to filter entities
  • Returns: A task whose result is the retrieved list

Fast.SqlSugar.ISqlSugarRepository.ToList ​

Source · Targets: net8.0, net9.0, net10.0

csharp
List<TEntity> ToList(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression,
        OrderByType orderByType = OrderByType.Asc);

Gets a list

  • Parameter whereExpression: Condition expression used to filter entities
  • Parameter orderByExpression: Expression specifying the sort field
  • Parameter orderByType: Sort direction
  • Returns: Retrieved list

Fast.SqlSugar.ISqlSugarRepository.ToListAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<List<TEntity>> ToListAsync(Expression<Func<TEntity, bool>> whereExpression,
        Expression<Func<TEntity, object>> orderByExpression, OrderByType orderByType = OrderByType.Asc);

Gets a list

  • Parameter whereExpression: Condition expression used to filter entities
  • Parameter orderByExpression: Expression specifying the sort field
  • Parameter orderByType: Sort direction
  • Returns: A task whose result is the retrieved list

Fast.SqlSugar.ISqlSugarRepository ​

Source · Targets: net8.0, net9.0, net10.0

csharp
public partial interface ISqlSugarRepository<TEntity>

SqlSugar update repository interface

Fast.SqlSugar.ISqlSugarRepository.Update ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Update(TEntity entity, bool isNoUpdateNull = false);

Updates one record

  • Parameter entity: Entity to process
  • Parameter isNoUpdateNull: Whether to skip properties whose values are null
  • Returns: Updates one record

Fast.SqlSugar.ISqlSugarRepository.UpdateAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> UpdateAsync(TEntity entity, bool isNoUpdateNull = false);

Updates one record

  • Parameter entity: Entity to process
  • Parameter isNoUpdateNull: Whether to skip properties whose values are null
  • Returns: A task representing an update of one record

Fast.SqlSugar.ISqlSugarRepository.Update ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Update(params TEntity[] entities);

Updates multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: Updates multiple records

Fast.SqlSugar.ISqlSugarRepository.UpdateAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> UpdateAsync(params TEntity[] entities);

Updates multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task representing an update of multiple records

Fast.SqlSugar.ISqlSugarRepository.Update ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int Update(IEnumerable<TEntity> entities);

Updates multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: Updates multiple records

Fast.SqlSugar.ISqlSugarRepository.UpdateAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> UpdateAsync(IEnumerable<TEntity> entities);

Updates multiple records

  • Parameter entities: Entities to process in a batch
  • Returns: A task representing an update of multiple records

Fast.SqlSugar.ISqlSugarRepository.UpdateNoPrimaryKey ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int UpdateNoPrimaryKey(TEntity entity, Expression<Func<TEntity, object>> columns);

Updates one record without a primary key

  • Parameter entity: Entity to process
  • Parameter columns: Columns included in the update
  • Returns: Updates one record without a primary key

Fast.SqlSugar.ISqlSugarRepository.UpdateNoPrimaryKeyAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> UpdateNoPrimaryKeyAsync(TEntity entity, Expression<Func<TEntity, object>> columns);

Updates one record without a primary key

  • Parameter entity: Entity to process
  • Parameter columns: Columns included in the update
  • Returns: A task representing an update of one record without a primary key

Fast.SqlSugar.ISqlSugarRepository.UpdateNoPrimaryKey ​

Source · Targets: net8.0, net9.0, net10.0

csharp
int UpdateNoPrimaryKey(List<TEntity> entity, Expression<Func<TEntity, object>> columns);

Updates multiple records without primary keys

  • Parameter entity: Entity to process
  • Parameter columns: Columns included in the update
  • Returns: Updates multiple records without primary keys

Fast.SqlSugar.ISqlSugarRepository.UpdateNoPrimaryKeyAsync ​

Source · Targets: net8.0, net9.0, net10.0

csharp
Task<int> UpdateNoPrimaryKeyAsync(List<TEntity> entity, Expression<Func<TEntity, object>> columns);

Updates multiple records without primary keys

  • Parameter entity: Entity to process
  • Parameter columns: Columns included in the update
  • Returns: A task representing an update of multiple records without primary keys