mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-23 13:21:59 +08:00
Support System.Ulid
This commit is contained in:
@@ -852,6 +852,10 @@ namespace SqlSugar
|
||||
{
|
||||
propertyInfo.SetValue(addItem, Convert.ToInt32(kv.Value));
|
||||
}
|
||||
else if (propertyInfo.PropertyType.FullName == "System.Ulid")
|
||||
{
|
||||
propertyInfo.SetValue(addItem,UtilMethods.To( kv.Value, propertyInfo.PropertyType));
|
||||
}
|
||||
else
|
||||
{
|
||||
propertyInfo.SetValue(addItem, kv.Value);
|
||||
|
||||
@@ -597,6 +597,15 @@ namespace SqlSugar
|
||||
var method = type.GetMethods().FirstOrDefault(it => it.GetParameters().Length == 1 && it.Name == "FromDateTime");
|
||||
return method.Invoke(null, new object[] { Convert.ToDateTime(value) });
|
||||
}
|
||||
else if (destinationType.FullName == "System.Ulid")
|
||||
{
|
||||
var method = destinationType.GetMyMethod("Parse", 1);
|
||||
if (method != null)
|
||||
{
|
||||
var result = method.Invoke(null, new object[] { value });
|
||||
return result;
|
||||
}
|
||||
}
|
||||
var destinationConverter = TypeDescriptor.GetConverter(destinationType);
|
||||
if (destinationConverter != null && destinationConverter.CanConvertFrom(value.GetType()))
|
||||
return destinationConverter.ConvertFrom(null, culture, value);
|
||||
|
||||
Reference in New Issue
Block a user