Skip to content
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

Fix fetching lazy component on not mapped interface #3320

Merged
merged 11 commits into from
Jun 20, 2023

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Jun 16, 2023

Fixes #3289

not a regression but let's fix in 5.4

@hazzik
Copy link
Member

hazzik commented Jun 17, 2023 via email

@bahusoid
Copy link
Member Author

We usually traverse all possible implementations in other places, not just
select first.

Nope. And why we need to do it here? Other place with explanation:

// When dealing with a polymorphic query it is not important which entity name we pick
// as they all need to have the same mapped types for members of the type that is queried.
// If one of the entites has a different type mapped (e.g. enum mapped as string instead of numeric),
// the query will fail to execute as currently the ParameterMetadata is bound to IQueryPlan and not to IQueryTranslator
// (e.g. s.Query<IEntity>().Where(a => a.MyEnum == MyEnum.Option)).
currentEntityName = sessionFactory.GetImplementors(currentEntityName).FirstOrDefault();

Ideally we should use ExpressionsHelper.TryGet methods but it's too early for it...

@hazzik
Copy link
Member

hazzik commented Jun 17, 2023 via email

@bahusoid
Copy link
Member Author

Was it a regression?

No (it's mentioned in pr description). But fix is simple so why not?

Copy link
Member

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

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

There is always a risk of introducing some new regression with each change. Ideally 5.4.x releases are meant to stabilize (fix regressions) the 5.4 minor version. Additional fixes added into it may delay its stabilization. And also, adding new fixes in it instead of vNext (5.5) is not an incentive to finish 5.5.

That said, sure, the fix seems to come with very little risks of unexpected consequences, and we have already accepted other little additional fixes in the past.

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.

3 participants