mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 04:18:16 +08:00
完善 CodeFirst
This commit is contained in:
@ -26,7 +26,8 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
switch (expCall.Method.Name) {
|
||||
case "Where": this.InternalWhere(expCall.Arguments[0]); break;
|
||||
case "WhereIf":
|
||||
if (_commonExpression.ExpressionSelectColumn_MemberAccess(null, null, SelectTableInfoType.From, expCall.Arguments[0], false) == "1")
|
||||
var whereIfCond = _commonExpression.ExpressionSelectColumn_MemberAccess(null, null, SelectTableInfoType.From, expCall.Arguments[0], false);
|
||||
if (whereIfCond == "1" || whereIfCond == "'t'")
|
||||
this.InternalWhere(expCall.Arguments[1]);
|
||||
break;
|
||||
case "GroupBy": this.InternalGroupBy(expCall.Arguments[0]); break;
|
||||
|
@ -66,7 +66,7 @@ namespace FreeSql.Internal.CommonProvider {
|
||||
if (cols.Any() == false) return this;
|
||||
foreach (var col in cols) {
|
||||
if (col.Column.Attribute.IsNullable) {
|
||||
var replval = col.Column.Attribute.DbDefautValue;
|
||||
var replval = _orm.CodeFirst.GetDbInfo(col.Column.CsType.GenericTypeArguments.FirstOrDefault())?.defaultValue;
|
||||
if (replval == null) continue;
|
||||
var replname = _commonUtils.QuoteSqlName(col.Column.Attribute.Name);
|
||||
expt = expt.Replace(replname, _commonUtils.IsNull(replname, _commonUtils.FormatSql("{0}", replval)));
|
||||
|
Reference in New Issue
Block a user