mysql/sqlserver CodeFirst 完成测试

This commit is contained in:
28810
2018-12-22 18:13:25 +08:00
parent 7a61aea544
commit 0ff422eeb6
26 changed files with 712 additions and 1067 deletions

View File

@@ -66,13 +66,10 @@ namespace FreeSql.Internal.CommonProvider {
if (cols.Any() == false) return this;
foreach (var col in cols) {
if (col.Column.Attribute.IsNullable) {
var repltype = col.Column.CsType;
if (repltype.FullName.StartsWith("System.Nullable`1[[System.")) repltype = repltype.GenericTypeArguments[0];
var replval = Activator.CreateInstance(repltype);
var replval = col.Column.Attribute.DbDefautValue;
if (replval == null) continue;
var replname = _commonUtils.QuoteSqlName(col.Column.Attribute.Name);
replval = _commonUtils.FormatSql("{0}", replval);
expt = expt.Replace(replname, _commonUtils.IsNull(replname, replval));
expt = expt.Replace(replname, _commonUtils.IsNull(replname, _commonUtils.FormatSql("{0}", replval)));
}
}
_set.Append(", ").Append(_commonUtils.QuoteSqlName(cols.First().Column.Attribute.Name)).Append(" = ").Append(expt);