Skip to content

Commit ad2a210

Browse files
committed
Avoid scanning all assemblies in AppDomain
1 parent f927135 commit ad2a210

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/Bonsai.Scripting.Expressions/ParsingConfigHelper.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static ParsingConfig CreateParsingConfig(params Type[] additionalTypes)
1717

1818
static IDynamicLinqCustomTypeProvider CreateCustomTypeProvider(ParsingConfig config, params Type[] additionalTypes)
1919
{
20-
return new DefaultDynamicLinqCustomTypeProvider(
20+
return new SimpleDynamicLinqCustomTypeProvider(
2121
config,
2222
additionalTypes.SelectMany(EnumerateTypeHierarchy).ToList());
2323
}
@@ -36,5 +36,21 @@ static IEnumerable<Type> EnumerateTypeHierarchy(Type type)
3636
type = type.BaseType;
3737
}
3838
}
39+
40+
class SimpleDynamicLinqCustomTypeProvider : DefaultDynamicLinqCustomTypeProvider
41+
{
42+
readonly HashSet<Type> customTypes;
43+
44+
public SimpleDynamicLinqCustomTypeProvider(ParsingConfig config, IList<Type> additionalTypes)
45+
: base(config, additionalTypes, cacheCustomTypes: false)
46+
{
47+
customTypes = new(AdditionalTypes);
48+
}
49+
50+
public override HashSet<Type> GetCustomTypes()
51+
{
52+
return customTypes;
53+
}
54+
}
3955
}
4056
}

0 commit comments

Comments
 (0)