Introduced IProviderSpecificMapperFactory, to allow some NPoco mappers to only be applied for specific providers, e.g. SqlCe and the SqlCEImageMapper

This commit is contained in:
Bjarke Berg
2021-07-05 08:24:44 +02:00
parent c8788ba996
commit 641530df14
9 changed files with 62 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence
private readonly DatabaseSchemaCreatorFactory _databaseSchemaCreatorFactory;
private readonly RetryPolicy _connectionRetryPolicy;
private readonly RetryPolicy _commandRetryPolicy;
//private readonly IEnumerable<IMapper> _mapperCollection;
private readonly IEnumerable<IMapper> _mapperCollection;
private readonly Guid _instanceGuid = Guid.NewGuid();
private List<CommandInfo> _commands;
@@ -50,8 +50,8 @@ namespace Umbraco.Cms.Infrastructure.Persistence
IBulkSqlInsertProvider bulkSqlInsertProvider,
DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory,
RetryPolicy connectionRetryPolicy = null,
RetryPolicy commandRetryPolicy = null
/*IEnumerable<IMapper> mapperCollection = null*/)
RetryPolicy commandRetryPolicy = null,
IEnumerable<IMapper> mapperCollection = null)
: base(connectionString, sqlContext.DatabaseType, provider, sqlContext.SqlSyntax.DefaultIsolationLevel)
{
SqlContext = sqlContext;
@@ -60,7 +60,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence
_databaseSchemaCreatorFactory = databaseSchemaCreatorFactory;
_connectionRetryPolicy = connectionRetryPolicy;
_commandRetryPolicy = commandRetryPolicy;
//_mapperCollection = mapperCollection;
_mapperCollection = mapperCollection;
Init();
}
@@ -85,10 +85,10 @@ namespace Umbraco.Cms.Infrastructure.Persistence
{
EnableSqlTrace = EnableSqlTraceDefault;
NPocoDatabaseExtensions.ConfigureNPocoBulkExtensions();
//if (_mapperCollection != null)
//{
// Mappers.AddRange(_mapperCollection);
//}
if (_mapperCollection != null)
{
Mappers.AddRange(_mapperCollection);
}
}
#endregion