Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/System.Linq.Dynamic.Core/Parser/ExpressionParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,14 @@ private Expression ParseIdentifier()
var isValidKeyWord = _keywordsHelper.TryGetValue(_textParser.CurrentToken.Text, out var value);

var extraCondition = !_parsingConfig.PrioritizePropertyOrFieldOverTheType ||
Comment thread
abbasc52 marked this conversation as resolved.
Outdated
(_parsingConfig.PrioritizePropertyOrFieldOverTheType && !(value is Type && _it != null && FindPropertyOrField(_it.Type, _textParser.CurrentToken.Text, false) != null));
(_parsingConfig.PrioritizePropertyOrFieldOverTheType
&& !(value is Type
&& ((_it != null && FindPropertyOrField(_it.Type, _textParser.CurrentToken.Text, false) != null)
|| _symbols.ContainsKey(_textParser.CurrentToken.Text)

))

);

if (isValidKeyWord && extraCondition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,14 @@ public void Parse_NullableShouldReturnNullable(string expression, object resultT
[InlineData("Company.Equals(null, null)", "Equals(null, null)")]
[InlineData("MainCompany.Name", "company.MainCompany.Name")]
[InlineData("Name", "company.Name")]
[InlineData("company.Name","company.Name")]
[InlineData("DateTime", "company.DateTime")]
public void Parse_When_PrioritizePropertyOrFieldOverTheType_IsTrue(string expression, string result)
{
// Arrange
var config = new ParsingConfig
{
IsCaseSensitive = true,
CustomTypeProvider = _dynamicTypeProviderMock.Object
};
ParameterExpression[] parameters = { ParameterExpressionHelper.CreateParameterExpression(typeof(Company), "company") };
Expand Down