diff --git a/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSpecificMapperFactory.cs b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSpecificMapperFactory.cs new file mode 100644 index 0000000000..1943aa251a --- /dev/null +++ b/src/Umbraco.Cms.Persistence.SqlServer/Services/SqlServerSpecificMapperFactory.cs @@ -0,0 +1,11 @@ +using Umbraco.Cms.Core.Mapping; +using Umbraco.Cms.Infrastructure.Persistence; + +namespace Umbraco.Cms.Persistence.SqlServer.Services; + +public class SqlServerSpecificMapperFactory : IProviderSpecificMapperFactory +{ + public string ProviderName => Constants.ProviderName; + + public NPocoMapperCollection Mappers => new(() => new[] { new UmbracoDefaultMapper() }); +} diff --git a/src/Umbraco.Cms.Persistence.SqlServer/UmbracoBuilderExtensions.cs b/src/Umbraco.Cms.Persistence.SqlServer/UmbracoBuilderExtensions.cs index aa4743faf8..abe893180a 100644 --- a/src/Umbraco.Cms.Persistence.SqlServer/UmbracoBuilderExtensions.cs +++ b/src/Umbraco.Cms.Persistence.SqlServer/UmbracoBuilderExtensions.cs @@ -22,6 +22,8 @@ public static class UmbracoBuilderExtensions /// public static IUmbracoBuilder AddUmbracoSqlServerSupport(this IUmbracoBuilder builder) { + builder.Services.TryAddEnumerable(ServiceDescriptor + .Singleton()); builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton()); builder.Services.TryAddEnumerable(ServiceDescriptor .Singleton()); diff --git a/src/Umbraco.Cms.Persistence.Sqlite/Mappers/SqlitePocoGuidMapper.cs b/src/Umbraco.Cms.Persistence.Sqlite/Mappers/SqlitePocoGuidMapper.cs index 930478e453..ab62b4b1d1 100644 --- a/src/Umbraco.Cms.Persistence.Sqlite/Mappers/SqlitePocoGuidMapper.cs +++ b/src/Umbraco.Cms.Persistence.Sqlite/Mappers/SqlitePocoGuidMapper.cs @@ -1,3 +1,4 @@ +using System.Globalization; using NPoco; namespace Umbraco.Cms.Persistence.Sqlite.Mappers; @@ -28,6 +29,24 @@ public class SqlitePocoGuidMapper : DefaultMapper }; } + 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); } } diff --git a/src/Umbraco.Infrastructure/Mapping/UmbracoDefaultMapper.cs b/src/Umbraco.Infrastructure/Mapping/UmbracoDefaultMapper.cs new file mode 100644 index 0000000000..986bb19d39 --- /dev/null +++ b/src/Umbraco.Infrastructure/Mapping/UmbracoDefaultMapper.cs @@ -0,0 +1,30 @@ +using System.Globalization; +using NPoco; + +namespace Umbraco.Cms.Core.Mapping; + +public class UmbracoDefaultMapper : DefaultMapper +{ + public override Func 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); + } +} diff --git a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs index 03859a97e7..14976717be 100644 --- a/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs +++ b/src/Umbraco.PublishedCache.NuCache/DataSource/BTree.cs @@ -22,10 +22,6 @@ public class BTree // default is 4096, min 2^9 = 512, max 2^16 = 64K FileBlockSize = GetBlockSize(settings), - // HACK: Forces FileOptions to be WriteThrough here: https://github.com/mamift/CSharpTest.Net.Collections/blob/9f93733b3af7ee0e2de353e822ff54d908209b0b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs#L316-L327, - // as the reflection uses otherwise will failed in .NET Core as the "_handle" field in FileStream is renamed to "_fileHandle". - StoragePerformance = StoragePerformance.CommitToDisk, - // other options? }; diff --git a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj index 368536d432..2a68119f16 100644 --- a/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj +++ b/src/Umbraco.PublishedCache.NuCache/Umbraco.PublishedCache.NuCache.csproj @@ -7,8 +7,8 @@ - +