Skip to content

Fix OData filtering by a base class member #2387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2020

Conversation

maca88
Copy link
Contributor

@maca88 maca88 commented May 17, 2020

Fixes #2380

@@ -87,6 +87,9 @@ public IASTNode Translate(ISessionFactoryImplementor sessionFactory, bool filter

var requiredHqlParameters = new List<NamedParameterDescriptor>();
var queryModel = NhRelinqQueryParser.Parse(_expression);
// Use the modified TransparentIdentifierRemovingExpressionVisitor in order to support expressions that were created
// programmatically and do not mimic what the C# compiler generates.
queryModel.TransformExpressions(TransparentIdentifierRemovingExpressionVisitor.ReplaceTransparentIdentifiers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fortunately that is cached in the query plan cache, so it is acceptable to traverse it again I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, the only thing that we could do is to make the capacity of the query cache configurable as currently is hardcoded to 128

private readonly SoftLimitMRUCache planCache = new SoftLimitMRUCache(128);

which may be a little to small for larger applications. Of course, this should be done in a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, this should be done in a separate PR.

Especially since that could be a deep rabbit hole. I think we should instead get rid of this SoftLimitMRUCache and use something like System.Runtime.MemoryCache.

The limit is hardcoded to 128, but that is not a strong limit. SoftLimitMRUCache uses only weak references past 128 entries and lets the garbage collector decides whether to free them or not.

@hazzik hazzik merged commit 02fc529 into nhibernate:master May 19, 2020
@fredericDelaporte fredericDelaporte added this to the 5.3 milestone May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OData NotSupportedException MemberInit on base class member
3 participants