mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
- FreeSql.Generator 类型映射容错判断;
This commit is contained in:
parent
a17917e172
commit
35829f9010
@ -66,6 +66,8 @@ public class RazorModel {
|
|||||||
if (GetCsName(col.Name) != col.Name)
|
if (GetCsName(col.Name) != col.Name)
|
||||||
sb.Add("Name = \"" + col.Name + "\"");
|
sb.Add("Name = \"" + col.Name + "\"");
|
||||||
|
|
||||||
|
if (col.CsType != null)
|
||||||
|
{
|
||||||
var dbinfo = fsql.CodeFirst.GetDbInfo(col.CsType);
|
var dbinfo = fsql.CodeFirst.GetDbInfo(col.CsType);
|
||||||
if (dbinfo != null && dbinfo.Value.dbtypeFull.Replace("NOT NULL", "").Trim() != col.DbTypeTextFull)
|
if (dbinfo != null && dbinfo.Value.dbtypeFull.Replace("NOT NULL", "").Trim() != col.DbTypeTextFull)
|
||||||
sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
|
sb.Add("DbType = \"" + col.DbTypeTextFull + "\"");
|
||||||
@ -74,12 +76,14 @@ public class RazorModel {
|
|||||||
if (col.IsIdentity)
|
if (col.IsIdentity)
|
||||||
sb.Add("IsIdentity = true");
|
sb.Add("IsIdentity = true");
|
||||||
|
|
||||||
if (dbinfo != null && dbinfo.Value.isnullable != col.IsNullable) {
|
if (dbinfo != null && dbinfo.Value.isnullable != col.IsNullable)
|
||||||
|
{
|
||||||
if (col.IsNullable && fsql.DbFirst.GetCsType(col).Contains("?") == false && col.CsType.IsValueType)
|
if (col.IsNullable && fsql.DbFirst.GetCsType(col).Contains("?") == false && col.CsType.IsValueType)
|
||||||
sb.Add("IsNullable = true");
|
sb.Add("IsNullable = true");
|
||||||
if (col.IsNullable == false && fsql.DbFirst.GetCsType(col).Contains("?") == true)
|
if (col.IsNullable == false && fsql.DbFirst.GetCsType(col).Contains("?") == true)
|
||||||
sb.Add("IsNullable = false");
|
sb.Add("IsNullable = false");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (sb.Any() == false) return null;
|
if (sb.Any() == false) return null;
|
||||||
return "[Column(" + string.Join(", ", sb) + ")]";
|
return "[Column(" + string.Join(", ", sb) + ")]";
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,13 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</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)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
|
@ -83,6 +83,21 @@ public class g
|
|||||||
.Build());
|
.Build());
|
||||||
public static IFreeSql dameng => damemgLazy.Value;
|
public static IFreeSql dameng => damemgLazy.Value;
|
||||||
|
|
||||||
|
|
||||||
|
static Lazy<IFreeSql> gbaseLazy = new Lazy<IFreeSql>(() => 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
|
//启动神州通用数据库 /etc/init.d/oscardb_OSRDBd start
|
||||||
//SYSDBA 密码 szoscar55
|
//SYSDBA 密码 szoscar55
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user