From 06610fbfafc447fd1032f4597a1a75579b310cee Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Mon, 29 Jul 2024 20:41:14 +0200 Subject: [PATCH] Update DefaultDynamicLinqCustomTypeProvider constructor to be compatible with microsoft/RulesEngine (#833) * Update DefaultDynamicLinqCustomTypeProvider to make ParsingConfig optional * Obsolete --- .../DefaultDynamicLinqCustomTypeProvider.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/System.Linq.Dynamic.Core/CustomTypeProviders/DefaultDynamicLinqCustomTypeProvider.cs b/src/System.Linq.Dynamic.Core/CustomTypeProviders/DefaultDynamicLinqCustomTypeProvider.cs index fc58ec0f..f69c9c49 100644 --- a/src/System.Linq.Dynamic.Core/CustomTypeProviders/DefaultDynamicLinqCustomTypeProvider.cs +++ b/src/System.Linq.Dynamic.Core/CustomTypeProviders/DefaultDynamicLinqCustomTypeProvider.cs @@ -22,6 +22,16 @@ public class DefaultDynamicLinqCustomTypeProvider : AbstractDynamicLinqCustomTyp private HashSet? _cachedCustomTypes; private Dictionary>? _cachedExtensionMethods; + /// + /// Initializes a new instance of the class. + /// Backwards compatibility for issue https://github.com/zzzprojects/System.Linq.Dynamic.Core/issues/830. + /// + /// Defines whether to cache the CustomTypes (including extension methods) which are found in the Application Domain. Default set to 'true'. + [Obsolete("Please use the DefaultDynamicLinqCustomTypeProvider(ParsingConfig config, bool cacheCustomTypes = true) constructor.")] + public DefaultDynamicLinqCustomTypeProvider(bool cacheCustomTypes = true) : this(ParsingConfig.Default, cacheCustomTypes) + { + } + /// /// Initializes a new instance of the class. /// @@ -29,7 +39,7 @@ public class DefaultDynamicLinqCustomTypeProvider : AbstractDynamicLinqCustomTyp /// Defines whether to cache the CustomTypes (including extension methods) which are found in the Application Domain. Default set to 'true'. public DefaultDynamicLinqCustomTypeProvider(ParsingConfig config, bool cacheCustomTypes = true) { - _assemblyHelper = new DefaultAssemblyHelper(config); + _assemblyHelper = new DefaultAssemblyHelper(Check.NotNull(config)); _cacheCustomTypes = cacheCustomTypes; }