V11: Fix decimal variants (#13741)
* fix sqlite with variants
* Create and register SqlSpecificMapper
* Delete obsolete file
* Add back inheritance
Co-authored-by: Zeegaan <nge@umbraco.dk>
(cherry picked from commit c868c60ed2)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
f9aaf1984a
commit
747f2e7599
30
src/Umbraco.Infrastructure/Mapping/UmbracoDefaultMapper.cs
Normal file
30
src/Umbraco.Infrastructure/Mapping/UmbracoDefaultMapper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Globalization;
|
||||
using NPoco;
|
||||
|
||||
namespace Umbraco.Cms.Core.Mapping;
|
||||
|
||||
public class UmbracoDefaultMapper : DefaultMapper
|
||||
{
|
||||
public override Func<object, object?> GetFromDbConverter(Type destType, Type sourceType)
|
||||
{
|
||||
if (destType == typeof(decimal))
|
||||
{
|
||||
return value =>
|
||||
{
|
||||
var result = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
if (destType == typeof(decimal?))
|
||||
{
|
||||
return value =>
|
||||
{
|
||||
var result = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
return base.GetFromDbConverter(destType, sourceType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user