Skip to content

Commit 8e6dfa0

Browse files
Merge pull request #390 from zzzprojects/stef_PredefinedTypesHelper_DynamicFunctions
Fixed loading "Microsoft.EntityFrameworkCore.DynamicLinq.DynamicFunctions"
2 parents db3508c + d18fab8 commit 8e6dfa0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/System.Linq.Dynamic.Core/Parser/PredefinedTypesHelper.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
using System.Collections.Concurrent;
22
using System.Collections.Generic;
33
using System.Linq.Dynamic.Core.Validation;
4+
using System.Text.RegularExpressions;
45

56
namespace System.Linq.Dynamic.Core.Parser
67
{
78
internal static class PredefinedTypesHelper
89
{
10+
private static readonly string Version = Regex.Match(typeof(PredefinedTypesHelper).AssemblyQualifiedName, @"\d+\.\d+\.\d+\.\d+").ToString();
11+
912
// These shorthands have different name than actual type and therefore not recognized by default from the PredefinedTypes.
1013
public static readonly IDictionary<string, Type> PredefinedTypesShorthands = new Dictionary<string, Type>
1114
{
@@ -63,7 +66,7 @@ static PredefinedTypesHelper()
6366
#endif
6467

6568
#if NETSTANDARD2_0
66-
TryAdd("Microsoft.EntityFrameworkCore.DynamicLinq.DynamicFunctions, Microsoft.EntityFrameworkCore.DynamicLinq, Version=1.0.0.0, Culture=neutral, PublicKeyToken=974e7e1b462f3693", 3);
69+
TryAdd($"Microsoft.EntityFrameworkCore.DynamicLinq.DynamicFunctions, Microsoft.EntityFrameworkCore.DynamicLinq, Version={Version}, Culture=neutral, PublicKeyToken=974e7e1b462f3693", 3);
6770
#endif
6871
}
6972

@@ -94,7 +97,7 @@ public static bool IsPredefinedType(ParsingConfig config, Type type)
9497
return true;
9598
}
9699

97-
return config.CustomTypeProvider != null &&
100+
return config.CustomTypeProvider != null &&
98101
(config.CustomTypeProvider.GetCustomTypes().Contains(type) || config.CustomTypeProvider.GetCustomTypes().Contains(nonNullableType));
99102
}
100103
}

0 commit comments

Comments
 (0)