Search Results for

    Show / Hide Table of Contents

    Interface ICodeFirst

    Namespace: FreeSql
    Assembly: FreeSql.dll
    Syntax
    public interface ICodeFirst

    Properties

    | Improve this Doc View Source

    IsAutoSyncStructure

    【开发环境必备】自动同步实体结构到数据库,程序运行中检查实体表是否存在,然后创建或修改

    Declaration
    bool IsAutoSyncStructure { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsConfigEntityFromDbFirst

    将数据库的主键、自增、索引设置导入,适用 DbFirst 模式,无须在实体类型上设置 [Column(IsPrimary)] 或者 ConfigEntity。此功能目前可用于 mysql/sqlserver/postgresql/oracle。

    本功能会影响 IFreeSql 首次访问的速度。

    若使用 CodeFirst 创建索引后,又直接在数据库上建了索引,若无本功能下一次 CodeFirst 迁移时数据库上创建的索引将被删除

    Declaration
    bool IsConfigEntityFromDbFirst { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsGenerateCommandParameterWithLambda

    是否生成命令参数化执行,针对 lambda 表达式解析

    注意:常量不会参数化,变量才会做参数化

    var id = 100; fsql.Select<T>().Where(a => a.id == id) 会参数化

    fsql.Select<T>().Where(a => a.id == 100) 不会参数化

    Declaration
    bool IsGenerateCommandParameterWithLambda { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsLazyLoading

    延时加载导航属性对象,导航属性需要声明 virtual

    Declaration
    bool IsLazyLoading { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsNoneCommandParameter

    不使用命令参数化执行,针对 Insert/Update

    Declaration
    bool IsNoneCommandParameter { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsSyncStructureToLower

    转小写同步结构,适用 PostgreSQL

    Declaration
    bool IsSyncStructureToLower { get; set; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsSyncStructureToUpper

    转大写同步结构,适用 Oracle/达梦/人大金仓

    Declaration
    bool IsSyncStructureToUpper { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    ConfigEntity(Type, Action<TableFluent>)

    FreeSql FluentApi 配置实体,方法名与特性相同

    Declaration
    ICodeFirst ConfigEntity(Type type, Action<TableFluent> entity)
    Parameters
    Type Name Description
    System.Type type
    System.Action<TableFluent> entity
    Returns
    Type Description
    ICodeFirst
    | Improve this Doc View Source

    ConfigEntity<T>(Action<TableFluent<T>>)

    FreeSql FluentApi 配置实体,方法名与特性相同

    Declaration
    ICodeFirst ConfigEntity<T>(Action<TableFluent<T>> entity)
    Parameters
    Type Name Description
    System.Action<TableFluent<T>> entity
    Returns
    Type Description
    ICodeFirst
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    GetComparisonDDLStatements(Type, String)

    将实体类型与数据库对比,返回DDL语句(指定表名)

    Declaration
    string GetComparisonDDLStatements(Type entityType, string tableName)
    Parameters
    Type Name Description
    System.Type entityType

    实体类型

    System.String tableName

    指定表名对比

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetComparisonDDLStatements(Type[])

    将实体类型集合与数据库对比,返回DDL语句

    Declaration
    string GetComparisonDDLStatements(params Type[] entityTypes)
    Parameters
    Type Name Description
    System.Type[] entityTypes

    实体类型

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetComparisonDDLStatements<TEntity>()

    将实体类型与数据库对比,返回DDL语句

    Declaration
    string GetComparisonDDLStatements<TEntity>()
    Returns
    Type Description
    System.String
    Type Parameters
    Name Description
    TEntity
    | Improve this Doc View Source

    GetConfigEntity(Type)

    获取 FreeSql FluentApi 配置实体的元数据

    Declaration
    TableAttribute GetConfigEntity(Type type)
    Parameters
    Type Name Description
    System.Type type
    Returns
    Type Description
    TableAttribute

    未使用ConfigEntity配置时,返回null

    | Improve this Doc View Source

    GetDbInfo(Type)

    根据 System.Type 获取数据库信息

    Declaration
    DbInfoResult GetDbInfo(Type type)
    Parameters
    Type Name Description
    System.Type type
    Returns
    Type Description
    DbInfoResult
    | Improve this Doc View Source

    GetTableByEntity(Type)

    获取实体类核心配置

    Declaration
    TableInfo GetTableByEntity(Type type)
    Parameters
    Type Name Description
    System.Type type
    Returns
    Type Description
    TableInfo
    | Improve this Doc View Source

    SyncStructure(Type, String, Boolean)

    同步实体类型到数据库(指定表名)

    注意:生产环境中谨慎使用

    Declaration
    void SyncStructure(Type entityType, string tableName, bool isForceSync = false)
    Parameters
    Type Name Description
    System.Type entityType

    实体类型

    System.String tableName

    指定表名对比

    System.Boolean isForceSync

    强制同步结构,无视缓存每次都同步

    | Improve this Doc View Source

    SyncStructure(Type[])

    同步实体类型集合到数据库

    注意:生产环境中谨慎使用

    Declaration
    void SyncStructure(params Type[] entityTypes)
    Parameters
    Type Name Description
    System.Type[] entityTypes
    | Improve this Doc View Source

    SyncStructure<TEntity>()

    同步实体类型到数据库

    注意:生产环境中谨慎使用

    Declaration
    void SyncStructure<TEntity>()
    Type Parameters
    Name Description
    TEntity

    Extension Methods

    FreeSqlGlobalDynamicEntityExtensions.DynamicEntity(FreeSql.ICodeFirst, System.String, System.Attribute[])
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX