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

Linq expressions not evaluated on collection parameters #2276

Open
v-kabanov opened this issue Nov 26, 2019 · 1 comment · May be fixed by #2291 or #2873
Open

Linq expressions not evaluated on collection parameters #2276

v-kabanov opened this issue Nov 26, 2019 · 1 comment · May be fixed by #2291 or #2873

Comments

@v-kabanov
Copy link

Originally reported under #2244, incorrect query is generated for

var selectedProducts = new[] { productDefinition1 };
var query = session.Query<Material>()
	.Where(x => selectedProducts.Contains(x.ProductDefinition) && selectedProducts.Select(y => y.MaterialDefinition).Contains(x.MaterialDefinition));

.Select(y => y.MaterialDefinition) is ignored and IDs of product definitions are inserted into the list of material definitions, i.e. SQL contains query to the effect of ... where MaterialDefinitionId in (ProductDefinitionId1, ProductDefinitionId2, ...).

Original standalone unit test: https://github.com/v-kabanov/Nh526QueryBug/blob/68498cf1f440db8694474f1b55a5efa31be2ae41/MyTest.cs#L207

New unit test integrated in a fork of NH repo added in commit v-kabanov@133b26d

It runs and fails but needs some further development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant