mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-06 08:20:52 +08:00
update
18
CodeFirst.md
18
CodeFirst.md
@@ -8,6 +8,24 @@ FreeSql 支持 CodeFirst 迁移结构至数据库,这应该是(O/RM)必须标
|
|||||||
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
|
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
|
||||||
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Max pool size=10")
|
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=127.0.0.1;Port=3306;User ID=root;Password=root;Initial Catalog=cccddd;Charset=utf8;SslMode=none;Max pool size=10")
|
||||||
.UseAutoSyncStructure(true) //自动同步实体结构【开发环境必备】
|
.UseAutoSyncStructure(true) //自动同步实体结构【开发环境必备】
|
||||||
|
|
||||||
|
.UseMonitorCommand(cmd => Console.Write(cmd.CommandText))
|
||||||
|
.UseSeedData(sd => sd //CodeFirst 种子数据
|
||||||
|
.Apply(new[]
|
||||||
|
{
|
||||||
|
new Products { Id = 1, title = "product-1" },
|
||||||
|
new Products { Id = 2, title = "product-2" },
|
||||||
|
new Products { Id = 3, title = "product-3" },
|
||||||
|
new Products { Id = 4, title = "product-4" }
|
||||||
|
})
|
||||||
|
.Apply(new[]
|
||||||
|
{
|
||||||
|
new S_SysConfig { Name = "testkey11", clicks = 11, title = "testtitle11" },
|
||||||
|
new S_SysConfig { Name = "testkey22", clicks = 22, title = "testtitle22" },
|
||||||
|
new S_SysConfig { Name = "testkey33", clicks = 33, title = "testtitle33" }
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
.Build(); //请务必定义成 Singleton 单例模式
|
.Build(); //请务必定义成 Singleton 单例模式
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
1
更新日志.md
1
更新日志.md
@@ -4,6 +4,7 @@
|
|||||||
## v1.4.0-preview
|
## v1.4.0-preview
|
||||||
|
|
||||||
- 修复 PostgreSQL CodeFirst/DbFirst 系统表的版本兼容问题;
|
- 修复 PostgreSQL CodeFirst/DbFirst 系统表的版本兼容问题;
|
||||||
|
- 增加 FreeSqlBuilder UseSeedData 设定 CodeFirst 种子数据;
|
||||||
|
|
||||||
## v1.3.4
|
## v1.3.4
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user