mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 13:03:43 +08:00
同步代码
This commit is contained in:
@@ -211,7 +211,7 @@ namespace SqlSugar
|
||||
var date = dr.GetValue(i);
|
||||
if (date is DateTime)
|
||||
{
|
||||
return UtilMethods.GetDateTimeOffsetByDateTime((DateTime)(date));
|
||||
return new DateTimeOffset((DateTime)(date));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -229,7 +229,7 @@ namespace SqlSugar
|
||||
var date = dr.GetValue(i);
|
||||
if (date is DateTime)
|
||||
{
|
||||
return UtilMethods.GetDateTimeOffsetByDateTime((DateTime)(date));
|
||||
return new DateTimeOffset((DateTime)(date));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -410,6 +410,7 @@ namespace SqlSugar
|
||||
}
|
||||
public override bool AddRemark(EntityInfo entity)
|
||||
{
|
||||
var oldColumns = this.Context.DbMaintenance.GetColumnInfosByTableName(entity.DbTableName, false);
|
||||
var db = this.Context;
|
||||
db.DbMaintenance.AddTableRemark(entity.DbTableName, entity.TableDescription);
|
||||
List<EntityColumnInfo> columns = entity.Columns.Where(it => it.IsIgnore == false).ToList();
|
||||
@@ -422,10 +423,14 @@ namespace SqlSugar
|
||||
{
|
||||
item.Length = 36;
|
||||
}
|
||||
var columnInfo = oldColumns.FirstOrDefault(it => it.DbColumnName.EqualCase(item.DbColumnName));
|
||||
if (columnInfo.ColumnDescription.ObjToString() != item.ColumnDescription.ObjToString())
|
||||
{
|
||||
string sql = GetUpdateColumnSql(entity.DbTableName, mySqlCodeFirst.GetEntityColumnToDbColumn(entity, entity.DbTableName, item)) + " " + (item.IsIdentity ? "AUTO_INCREMENT" : "") + " " + " COMMENT '" + item.ColumnDescription + "'";
|
||||
db.Ado.ExecuteCommand(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
protected override string GetCreateTableSql(string tableName, List<DbColumnInfo> columns)
|
||||
|
@@ -141,6 +141,10 @@ namespace SqlSugar
|
||||
|
||||
public static DateTime ObjToDate(this object thisValue)
|
||||
{
|
||||
if (thisValue is DateTime)
|
||||
{
|
||||
return (DateTime)thisValue;
|
||||
}
|
||||
DateTime reval = DateTime.MinValue;
|
||||
if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
|
||||
{
|
||||
@@ -151,6 +155,10 @@ namespace SqlSugar
|
||||
|
||||
public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
|
||||
{
|
||||
if (thisValue is DateTime)
|
||||
{
|
||||
return (DateTime)thisValue;
|
||||
}
|
||||
DateTime reval = DateTime.MinValue;
|
||||
if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
|
||||
{
|
||||
|
Reference in New Issue
Block a user