Browse Source

Insertable list<T> Time Bug, DbFirst Bug

pull/12/MERGE
sunkaixuan 8 years ago
parent
commit
d3497faa69
  1. 10
      SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs
  2. 2
      SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs

10
SqlSugar/Abstract/DbFirstProvider/DbFirstProvider.cs

@ -39,10 +39,11 @@ namespace SqlSugar
public void Init()
{
this.TableInfoList = this.Context.DbMaintenance.GetTableInfoList();
if (this.Context.DbMaintenance.GetViewInfoList().IsValuable())
this.TableInfoList =this.Context.RewritableMethods.TranslateCopy(this.Context.DbMaintenance.GetTableInfoList());
var viewList = this.Context.DbMaintenance.GetViewInfoList();
if (viewList.IsValuable())
{
this.TableInfoList.AddRange(this.Context.DbMaintenance.GetViewInfoList());
this.TableInfoList.AddRange(viewList);
}
}
@ -198,6 +199,7 @@ namespace SqlSugar
{
result = "DateTime.Now";
}
result = result.Replace("\r", "\t").Replace("\n", "\t");
return result;
}
@ -284,7 +286,7 @@ namespace SqlSugar
private string GetPropertyDescriptionText(DbColumnInfo item, string propertyDescriptionText)
{
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyPropertyDescription, item.ColumnDescription);
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyDefaultValue, item.Value.ObjToString());
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyDefaultValue, GetProertypeDefaultValue(item));
propertyDescriptionText = propertyDescriptionText.Replace(DbFirstTemplate.KeyIsNullable, item.IsNullable.ObjToString());
return propertyDescriptionText;
}

2
SqlSugar/Abstract/SqlBuilderProvider/InsertBuilder.cs

@ -148,7 +148,7 @@ namespace SqlSugar
var type = value.GetType();
if (type == PubConst.DateType)
{
return "'" + value.ObjToDate().ToString("yyyy-MM-dd hh:mm:ss.ms") + "'";
return "'" + value.ObjToDate().ToString("yyyy-MM-dd hh:mm:ss.fff") + "'";
}
else if (type == PubConst.StringType|| type == PubConst.ObjType)
{

Loading…
Cancel
Save