FreeSql.Extensions.ZeroEntity
创建新的ZeroDbCotext实例
IfreeSql 对象
动态表结构描述
是否强制同步表结构
Schema 未验证通过时抛出验证异常
初始化一个 ZeroDbContext 对象,暂不指定任何Schema
同步指定表结构
从自定义中加载(多表)
- tableName 以及 Navigates 所依赖表 Schema
从数据库中加载(单表)
- 不支持 Navigates
- 不支持 Indexes IndexMethod
- 暂支持 SqlServer/MySql decimal(10,2)(其他数据库需实现对应 IDbFirst)
【有状态管理】自动 Include 查询
【无状态管理】指定表查询
Type = Update 的时候,获取更新之前的对象
实体变化记录
实体变化事件
举例1:LeftJoin("table1", "id", "user.id") -> LEFT JOIN [table1] b ON b.[id] = a.[id]
举例2:LeftJoin("table1", "id", "user.id", "xid", "user.xid") -> LEFT JOIN [table1] b ON b.[id] = [a].id] AND b.[xid] = a.[xid]
举例1:InnerJoin("table1", "id", "user.id") -> INNER JOIN [table1] b ON b.[id] = a.[id]
举例2:InnerJoin("table1", "id", "user.id", "xid", "user.xid") -> INNER JOIN [table1] b ON b.[id] = [a].id] AND b.[xid] = a.[xid]
举例1:RightJoin("table1", "id", "user.id") -> RIGTH JOIN [table1] b ON b.[id] = a.[id]
举例2:RightJoin("table1", "id", "user.id", "xid", "user.xid") -> RIGTH JOIN [table1] b ON b.[id] = [a].id] AND b.[xid] = a.[xid]
WHERE [Id] IN (1,2,3)
WHERE [field] IN (1,2,3)
WHERE [field] NOT IN (1,2,3)
匿名对象:Where(new { Year = 2017, CategoryId = 198, IsPublished = true })
字典对象:Where(new Dictionary<string, object> { ["Year"] = 2017, ["CategoryId"] = 198, ["IsPublished"] = true })
WHERE [Year] = 2017 AND [CategoryId] = 198 AND [IsPublished] = 1
WHERE [field] = ..
更全请看重载 Where(string field, string @operator, object value)
WHERE [field]
!=、>、>=、<、<=、like、!like、in、!in
WHERE 字段与字段
WHERE exists(select ...)