Skip to content

NH-3964 - Refactor reflection patterns #574

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 5 commits into from
Mar 23, 2017

Conversation

fredericDelaporte
Copy link
Member

@fredericDelaporte fredericDelaporte commented Mar 19, 2017

NH-3964 - This is a sort of follow up to NH-3952: remove usage of EnumerableHelper.
They were replaced by ReflectionHelper, and additionally cached whenever possible and useful.
This improvement aims at similarly caching other MethodInfo/PropertyInfo reflected through older ReflectionHelper usages (impacts Linq namespace), or any other means (most other NHibernate namespaces).
If adequate, those other means of reflecting should be replaced by ReflectionHelper.

@hazzik hazzik self-requested a review March 19, 2017 08:11
@fredericDelaporte
Copy link
Member Author

Rebased for resolving a conflict on test project.

@fredericDelaporte
Copy link
Member Author

fredericDelaporte commented Mar 21, 2017

By the way, I may refactor further if you wish: put the methods Hazzik was suggesting here in Util.ReflectHelper:

    public static MethodInfo GetMethod<T, TResult>(Func<T, TResult> func, T arg1)
    {
        return func.Method;
    }

Then obsolete Linq.ReflectionHelper (> 200 calls to move to ReflectHelper).

@hazzik
Copy link
Member

hazzik commented Mar 23, 2017

@fredericDelaporte I was trying to hijack the PR and added refactoring to use func.Method, but it did no work well. I think for now the PR can be merged as is.

@hazzik hazzik removed the needs work label Mar 23, 2017
@hazzik
Copy link
Member

hazzik commented Mar 23, 2017

@fredericDelaporte, if you are going to do more work in this field, please use the same JIRA number.

@hazzik hazzik merged commit e20eff1 into nhibernate:master Mar 23, 2017
@fredericDelaporte
Copy link
Member Author

Ok. I think Linq.ReflectionHelper should be consolidated into Util.ReflectHelper, and doing it with your methods would be better. I will probably come back later on that subject.

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.

2 participants