diff --git a/Extensions/FreeSql.Generator/RazorModel.cs b/Extensions/FreeSql.Generator/RazorModel.cs
index 80f7a855..d754ee2f 100644
--- a/Extensions/FreeSql.Generator/RazorModel.cs
+++ b/Extensions/FreeSql.Generator/RazorModel.cs
@@ -66,19 +66,23 @@ public class RazorModel {
if (GetCsName(col.Name) != col.Name)
sb.Add("Name = \"" + col.Name + "\"");
- var dbinfo = fsql.CodeFirst.GetDbInfo(col.CsType);
- if (dbinfo != null && dbinfo.Value.dbtypeFull.Replace("NOT NULL", "").Trim() != col.DbTypeTextFull)
- sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
- if (col.IsPrimary)
- sb.Add("IsPrimary = true");
- if (col.IsIdentity)
- sb.Add("IsIdentity = true");
+ if (col.CsType != null)
+ {
+ var dbinfo = fsql.CodeFirst.GetDbInfo(col.CsType);
+ if (dbinfo != null && dbinfo.Value.dbtypeFull.Replace("NOT NULL", "").Trim() != col.DbTypeTextFull)
+ sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
+ if (col.IsPrimary)
+ sb.Add("IsPrimary = true");
+ if (col.IsIdentity)
+ sb.Add("IsIdentity = true");
- if (dbinfo != null && dbinfo.Value.isnullable != col.IsNullable) {
- if (col.IsNullable && fsql.DbFirst.GetCsType(col).Contains("?") == false && col.CsType.IsValueType)
- sb.Add("IsNullable = true");
- if (col.IsNullable == false && fsql.DbFirst.GetCsType(col).Contains("?") == true)
- sb.Add("IsNullable = false");
+ if (dbinfo != null && dbinfo.Value.isnullable != col.IsNullable)
+ {
+ if (col.IsNullable && fsql.DbFirst.GetCsType(col).Contains("?") == false && col.CsType.IsValueType)
+ sb.Add("IsNullable = true");
+ if (col.IsNullable == false && fsql.DbFirst.GetCsType(col).Contains("?") == true)
+ sb.Add("IsNullable = false");
+ }
}
if (sb.Any() == false) return null;
return "[Column(" + string.Join(", ", sb) + ")]";
diff --git a/FreeSql.DbContext/FreeSql.DbContext.xml b/FreeSql.DbContext/FreeSql.DbContext.xml
index dc0203b8..d9f91124 100644
--- a/FreeSql.DbContext/FreeSql.DbContext.xml
+++ b/FreeSql.DbContext/FreeSql.DbContext.xml
@@ -110,6 +110,13 @@
清空状态数据
+
+
+ 根据 lambda 条件删除数据
+
+
+
+
添加
diff --git a/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/g.cs b/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/g.cs
index bd719336..7ae66c0d 100644
--- a/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/g.cs
+++ b/FreeSql.Tests/FreeSql.Tests.Provider.Odbc/g.cs
@@ -83,6 +83,21 @@ public class g
.Build());
public static IFreeSql dameng => damemgLazy.Value;
+
+ static Lazy gbaseLazy = new Lazy(() => new FreeSql.FreeSqlBuilder()
+ .UseConnectionString(FreeSql.DataType.OdbcDameng, "Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789")
+ //.UseConnectionFactory(FreeSql.DataType.OdbcDameng, () => new System.Data.Odbc.OdbcConnection("Driver={DM8 ODBC DRIVER};Server=127.0.0.1:5236;Persist Security Info=False;Trusted_Connection=Yes;UID=USER1;PWD=123456789"))
+ .UseAutoSyncStructure(true)
+ .UseLazyLoading(true)
+ .UseSyncStructureToUpper(true)
+ //.UseNoneCommandParameter(true)
+
+ .UseMonitorCommand(
+ cmd => Trace.WriteLine(cmd.CommandText), //监听SQL命令对象,在执行前
+ (cmd, traceLog) => Console.WriteLine(traceLog))
+ .Build());
+ public static IFreeSql gbase => gbaseLazy.Value;
+
//启动神州通用数据库 /etc/init.d/oscardb_OSRDBd start
//SYSDBA 密码 szoscar55