Skip to content

Commit 06610fb

Browse files
authored
Update DefaultDynamicLinqCustomTypeProvider constructor to be compatible with microsoft/RulesEngine (#833)
* Update DefaultDynamicLinqCustomTypeProvider to make ParsingConfig optional * Obsolete
1 parent 9dba825 commit 06610fb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/System.Linq.Dynamic.Core/CustomTypeProviders/DefaultDynamicLinqCustomTypeProvider.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,24 @@ public class DefaultDynamicLinqCustomTypeProvider : AbstractDynamicLinqCustomTyp
2222
private HashSet<Type>? _cachedCustomTypes;
2323
private Dictionary<Type, List<MethodInfo>>? _cachedExtensionMethods;
2424

25+
/// <summary>
26+
/// Initializes a new instance of the <see cref="DefaultDynamicLinqCustomTypeProvider"/> class.
27+
/// Backwards compatibility for issue https://github.com/zzzprojects/System.Linq.Dynamic.Core/issues/830.
28+
/// </summary>
29+
/// <param name="cacheCustomTypes">Defines whether to cache the CustomTypes (including extension methods) which are found in the Application Domain. Default set to 'true'.</param>
30+
[Obsolete("Please use the DefaultDynamicLinqCustomTypeProvider(ParsingConfig config, bool cacheCustomTypes = true) constructor.")]
31+
public DefaultDynamicLinqCustomTypeProvider(bool cacheCustomTypes = true) : this(ParsingConfig.Default, cacheCustomTypes)
32+
{
33+
}
34+
2535
/// <summary>
2636
/// Initializes a new instance of the <see cref="DefaultDynamicLinqCustomTypeProvider"/> class.
2737
/// </summary>
2838
/// <param name="config">The parsing configuration.</param>
2939
/// <param name="cacheCustomTypes">Defines whether to cache the CustomTypes (including extension methods) which are found in the Application Domain. Default set to 'true'.</param>
3040
public DefaultDynamicLinqCustomTypeProvider(ParsingConfig config, bool cacheCustomTypes = true)
3141
{
32-
_assemblyHelper = new DefaultAssemblyHelper(config);
42+
_assemblyHelper = new DefaultAssemblyHelper(Check.NotNull(config));
3343
_cacheCustomTypes = cacheCustomTypes;
3444
}
3545

0 commit comments

Comments
 (0)