diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml
index 5ca74890..2acb6679 100644
--- a/FreeSql.DbContext/FreeSql.DbContext.xml
+++ b/FreeSql.DbContext/FreeSql.DbContext.xml
@@ -130,6 +130,13 @@
清空状态数据
+
+
+ 根据 lambda 条件删除数据
+
+
+
+
添加
@@ -520,5 +527,14 @@
+
+
+ 批量注入 Repository,可以参考代码自行调整
+
+
+
+
+
+
diff --git a/FreeSql.Tests/FreeSql.Tests/UnitTest3.cs b/FreeSql.Tests/FreeSql.Tests/UnitTest3.cs
index ba54689f..d89e4db3 100644
--- a/FreeSql.Tests/FreeSql.Tests/UnitTest3.cs
+++ b/FreeSql.Tests/FreeSql.Tests/UnitTest3.cs
@@ -158,20 +158,30 @@ namespace FreeSql.Tests
class testInsertNullable
{
- [Column(IsIdentity = true)]
+ [Column(IsNullable = false, IsIdentity = true)]
public long Id { get; set; }
[Column(IsNullable = false)]
public string str1 { get; set; }
[Column(IsNullable = false)]
public int? int1 { get; set; }
+ [Column(IsNullable = true)]
+ public int int2 { get; set; }
}
[Fact]
public void Test03()
{
g.sqlite.Insert(new testInsertNullable()).NoneParameter().ExecuteAffrows();
-
+ var ddlsql = g.sqlite.CodeFirst.GetComparisonDDLStatements(typeof(testInsertNullable), "tb123123");
+ Assert.Equal(@"CREATE TABLE IF NOT EXISTS ""main"".""tb123123"" (
+ ""Id"" INTEGER PRIMARY KEY AUTOINCREMENT,
+ ""str1"" NVARCHAR(255) NOT NULL,
+ ""int1"" INTEGER NOT NULL,
+ ""int2"" INTEGER
+)
+;
+", ddlsql);
var sqlxx = g.pgsql.InsertOrUpdate().SetSource(new userinfo { userid = 10 }).UpdateColumns(a => new { a.birthday, a.CardNo }).ToSql();
diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs
index 2b81e503..549cdac1 100644
--- a/FreeSql/Internal/UtilsExpressionTree.cs
+++ b/FreeSql/Internal/UtilsExpressionTree.cs
@@ -122,7 +122,7 @@ namespace FreeSql.Internal
colattr.DbType = colattr.DbType.ToUpper();
if (colattrIsNull == false && colattrIsNullable == true) colattr.DbType = colattr.DbType.Replace("NOT NULL", "");
- if (colattrIsNull == false && colattrIsNullable == false) colattr.DbType = Regex.Replace(colattr.DbType, @"\bNULL\b", "").Trim() + " NOT NULL";
+ if (colattrIsNull == false && colattrIsNullable == false && colattr.DbType.Contains("NOT NULL") == false) colattr.DbType = Regex.Replace(colattr.DbType, @"\bNULL\b", "").Trim() + " NOT NULL";
if (colattr._IsNullable == null && tp != null && tp.isnullable == null) colattr.IsNullable = tp.dbtypeFull.Contains("NOT NULL") == false;
if (colattr.DbType?.Contains("NOT NULL") == true) colattr.IsNullable = false;
if (string.IsNullOrEmpty(colattr.Name)) colattr.Name = p.Name;