From ec5d1936bfbbcb7dac43dcb0dd1bd641464ef529 Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Thu, 2 Apr 2020 15:50:48 +0800 Subject: [PATCH] update --- CodeFirst.md | 18 ++++++++++++++++++ 更新日志.md | 1 + 2 files changed, 19 insertions(+) diff --git a/CodeFirst.md b/CodeFirst.md index 9258a9c..f1d45e0 100644 --- a/CodeFirst.md +++ b/CodeFirst.md @@ -8,6 +8,24 @@ FreeSql 支持 CodeFirst 迁移结构至数据库,这应该是(O/RM)必须标 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") .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 单例模式 ``` diff --git a/更新日志.md b/更新日志.md index a66f8d3..1ef6f6f 100644 --- a/更新日志.md +++ b/更新日志.md @@ -4,6 +4,7 @@ ## v1.4.0-preview - 修复 PostgreSQL CodeFirst/DbFirst 系统表的版本兼容问题; +- 增加 FreeSqlBuilder UseSeedData 设定 CodeFirst 种子数据; ## v1.3.4