Revert to _mapper assignment in constructor. (#140)

This commit is contained in:
Hasan Manzak 2021-05-16 18:20:16 +03:00 committed by GitHub
parent a5b9e5757e
commit cc9c2b0a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,13 +70,13 @@ namespace Sieve.Services
private const string NullFilterValue = "null"; private const string NullFilterValue = "null";
private readonly ISieveCustomSortMethods _customSortMethods; private readonly ISieveCustomSortMethods _customSortMethods;
private readonly ISieveCustomFilterMethods _customFilterMethods; private readonly ISieveCustomFilterMethods _customFilterMethods;
private SievePropertyMapper _mapper; private readonly SievePropertyMapper _mapper = new SievePropertyMapper();
private SievePropertyMapper Mapper => _mapper ??= MapProperties(new SievePropertyMapper());
public SieveProcessor(IOptions<SieveOptions> options, public SieveProcessor(IOptions<SieveOptions> options,
ISieveCustomSortMethods customSortMethods, ISieveCustomSortMethods customSortMethods,
ISieveCustomFilterMethods customFilterMethods) ISieveCustomFilterMethods customFilterMethods)
{ {
_mapper = MapProperties(_mapper);
Options = options; Options = options;
_customSortMethods = customSortMethods; _customSortMethods = customSortMethods;
_customFilterMethods = customFilterMethods; _customFilterMethods = customFilterMethods;
@ -85,6 +85,7 @@ namespace Sieve.Services
public SieveProcessor(IOptions<SieveOptions> options, public SieveProcessor(IOptions<SieveOptions> options,
ISieveCustomSortMethods customSortMethods) ISieveCustomSortMethods customSortMethods)
{ {
_mapper = MapProperties(_mapper);
Options = options; Options = options;
_customSortMethods = customSortMethods; _customSortMethods = customSortMethods;
} }
@ -92,12 +93,14 @@ namespace Sieve.Services
public SieveProcessor(IOptions<SieveOptions> options, public SieveProcessor(IOptions<SieveOptions> options,
ISieveCustomFilterMethods customFilterMethods) ISieveCustomFilterMethods customFilterMethods)
{ {
_mapper = MapProperties(_mapper);
Options = options; Options = options;
_customFilterMethods = customFilterMethods; _customFilterMethods = customFilterMethods;
} }
public SieveProcessor(IOptions<SieveOptions> options) public SieveProcessor(IOptions<SieveOptions> options)
{ {
_mapper = MapProperties(_mapper);
Options = options; Options = options;
} }