-
Notifications
You must be signed in to change notification settings - Fork 930
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
Wrong statement when child classes have same property name but different types #3363
Comments
Looks like duplicate of #1189 |
Actually can be same issue. I can add I had the case working in production until 5.2.7, it breaks after 5.3.0 included. |
So, it would be a 5.3.x regression. I consider checking this before releasing the next 5.4.x. |
I see it's about #1189 + I have no good fix for this case in mind - you better avoid using the same names in subclasses for different entities. |
actually this is current solution adopted, but, if this is the case, some exception in mapping phase should complain, otherwise is easy to be confused. |
By looking at current code base, looks like there is something wrong here: (
So this function is called collecting a property name/type map for the entire hierarchy of an entity, so, if down the entire tree some property have same name, entry will be overwritten, causing unexpected behaviors. I had issues compiling 5.2.7 tag because of missing requirement, but maybe in the previous version this was called only for single entity? |
No, I do not think this has changed. What has changed is #2081, fixing #1274. Your mapping uses (About issues for compiling, switching from 5.4.x to a lower version branch usually requires cleaning, closing the solution in VS, restoring. Actually, it is more reliable to close the solution after switching branch, purge all bin and obj folders, reopen the solution.) So, by fixing a |
So, this is still a regression caused by #2081. But maybe a tough one to fix, hitting what is in my opinion a corner case ( |
Agree. Not easy fixable. No need to wait I see that in the test case the same column name |
Hi @bahusoid, no, it is not to avoid foreign key creation. By the way, even if not modified, from what I saw, the function |
Yes the issue is more general (and known since long), but complex to fix, see #1189. Still, your specific case could be fixed by a "work-around": cease using that other "work-around" that is (That |
I think there is something not working while generating a query in a hierarchy of classes in which some derived classes have an association property with the same name but different many-to-one class. ie:
So if we look for a specific value of Thing property like this:
var result = session.Query<Mother>().Where(k => k is Child1 && (k as Child1).Thing.Id == "00001").ToList();
We do not find any record even if the record exists, as the query generated is left-joining the wrong table, ie:
That is, looks into table for Thing2, while we actually look for a Thing1...
Unit test in PR #3364
The text was updated successfully, but these errors were encountered: