-
Notifications
You must be signed in to change notification settings - Fork 934
Fetch requests do not work with collection projections #2341
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
base: master
Are you sure you want to change the base?
Conversation
Added tests to show nhibernate#1298 is fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Async code is missing. It can be generated via ShowBuildMenu.bat option H. Please note after
any modifications it needs to be regenerated again. And see my comments below
Resolved comments on PR2341
I've run the 'H' option in the buildmenu, but no code was generated... |
Fix Code Formatting
Fixed test: this shows the difference between Fetch/non-Fetch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run the 'H' option in the buildmenu, but no code was generated...
Well did it give you any error messages? There is async version of this file:
https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate.Test/Async/Linq/ProjectionsTests.cs
And for new added tests async counterparts should be generated.
Ah, I did have an error, but it wasn't obvious:
I don't have a netcoreapp2.1-folder. Only net472... |
Well yeah - .net core 2.1 is required to be installed on PC to make async generator work |
No, I don't have this folder: "../Tools/CSharpAsyncGenerator.CommandLine/0.18.1/tools/netcoreapp2.1/" in my git checkout. only "../Tools/CSharpAsyncGenerator.CommandLine/0.18.1/tools/net472/". Edit: I deleted my Tools folder, and now the package is restored correctly. I'm going to try and get this fixed tomorrow. Sorry for the inconvenience. |
public void ProjectAnonymousTypeWithCollection3WithFetch() | ||
{ | ||
var query = from o in db.Orders.Fetch(o => o.OrderLines) | ||
select new { OrderLines = o.OrderLines.ToList() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sql created from this query returns more than 7000 rows, I think that it would be better to use the PatientRecords
collection of Patient
which has less data:
var query = from o in db.Patients.Fetch(o => o.PatientRecords)
select new { PatientRecords = o.PatientRecords.ToList() };
the same applies for other queries that were added by this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I should just add the test from the original bug report. Since doing a Fetch when projecting a collection is actually redundant. Adding that one test will guard against a regression for this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I should just add the test from the original bug report
Fine by me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am also ok with that.
I'm sorry, but I'm unable to build the project using ShowBuildMenu. I emptied my .nuget folder, did a git-clean but I still get this exception: buildlog.txt Buildding in Visual Studio works, but generating the async code after building in Studio gives me the following exception: asynclog.txt |
The workaround would be to run following in the root of the repository:
(Please check what 2.1 SDK version you have first) @maca88 can you investigate support for .net 3.1? |
Which PR has fixed the issue, anyone? |
I had tried adding a global.json, but I probably used the wrong sdk-version. Anyhow: I changed the test as discussed. Only the test from the original Issue (#1298) is added and the async version is committed. |
Added tests to show #1298 is fixed on the current master.