mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 1.7.1 IsNullable 遗留问题;
This commit is contained in:
parent
549d36974d
commit
d602dfbaaa
@ -130,6 +130,13 @@
|
||||
清空状态数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
||||
<summary>
|
||||
根据 lambda 条件删除数据
|
||||
</summary>
|
||||
<param name="predicate"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||
<summary>
|
||||
添加
|
||||
@ -520,5 +527,14 @@
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
||||
<summary>
|
||||
批量注入 Repository,可以参考代码自行调整
|
||||
</summary>
|
||||
<param name="services"></param>
|
||||
<param name="globalDataFilter"></param>
|
||||
<param name="assemblies"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
@ -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<userinfo>().SetSource(new userinfo { userid = 10 }).UpdateColumns(a => new { a.birthday, a.CardNo }).ToSql();
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user