mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-20 09:28:53 +08:00
Update mysql CodeFirst
This commit is contained in:
parent
b1774c0ac4
commit
f8b242d0d3
@ -36,6 +36,7 @@ namespace SqlSugar
|
||||
protected override DbColumnInfo EntityColumnToDbColumn(EntityInfo entityInfo, string tableName, EntityColumnInfo item)
|
||||
{
|
||||
var propertyType = UtilMethods.GetUnderType(item.PropertyInfo);
|
||||
UtilMethods.SetDefaultValueForBoolean(item, propertyType);
|
||||
var result = new DbColumnInfo()
|
||||
{
|
||||
TableId = entityInfo.Columns.IndexOf(item),
|
||||
@ -47,7 +48,7 @@ namespace SqlSugar
|
||||
DefaultValue = item.DefaultValue,
|
||||
ColumnDescription = item.ColumnDescription,
|
||||
Length = item.Length,
|
||||
DecimalDigits=item.DecimalDigits,
|
||||
DecimalDigits = item.DecimalDigits,
|
||||
CreateTableFieldSort = item.CreateTableFieldSort
|
||||
};
|
||||
GetDbType(item, propertyType, result);
|
||||
|
||||
@ -18,6 +18,19 @@ namespace SqlSugar
|
||||
{
|
||||
public class UtilMethods
|
||||
{
|
||||
|
||||
internal static void SetDefaultValueForBoolean(EntityColumnInfo item, Type propertyType)
|
||||
{
|
||||
if (propertyType == UtilConstants.BoolType && item.DefaultValue != null && item.DefaultValue.EqualCase("true"))
|
||||
{
|
||||
item.DefaultValue = "1";
|
||||
}
|
||||
else if (propertyType == UtilConstants.BoolType && item.DefaultValue != null && item.DefaultValue.EqualCase("false"))
|
||||
{
|
||||
item.DefaultValue = "0";
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateQueryBuilderByClone<TResult>(QueryBuilder queryBuilder,ISugarQueryable<TResult> clone)
|
||||
{
|
||||
queryBuilder.MappingKeys = clone.QueryBuilder.MappingKeys;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user