Linq Expression Fails when I use OrderBy property.Length or mix Include,OrderBy and AutoMapper ProjectTo ClauseMany nested AggregateExceptionsEntity Framework 7 navigation property is nullEntity Framework Core 1.0.0 Disable Eager/Lazy LoadingInclude() with Wheres clause failingAutomapper Projection with Linq OrderBy child property errorAsp.Net Core Automapper LINQ expressionAutoMapper ProjectTo ignoring .IncludeThe property '' on entity type could not be found since upgrading to EF 2.1Automapper 7.0.1 ProjectTo mismatch types with ef core 2.1.1 linq joinThe LINQ expression could not be translated for base property
Insight into cavity resonators
How to write characters doing illogical things in a believable way?
Shouldn't countries like Russia and Canada support global warming?
shell script to check if input is a string/integer/float
What is this gigantic dish at Ben Gurion airport?
Amortized Loans seem to benefit the bank more than the customer
What are the advantages and disadvantages of tail wheels that cause modern airplanes to not use them?
What is a "major country" as named in Bernie Sanders' Healthcare debate answers?
Make 2019 with single digits
In what sequence should an advanced civilization teach technology to medieval society to maximize rate of adoption?
Ethernet, Wifi and a little human psychology
How to control the output voltage of a solid state relay
How to draw a Venn diagram for X - (Y intersect Z)?
How do certain apps show new notifications when internet access is restricted to them?
In what state are satellites left in when they are left in a graveyard orbit?
Why is the year in this ISO timestamp not 2019?
How to modify this code to add more vertical space in timeline that uses Tikz
Has SHA256 been broken by Treadwell Stanton DuPont?
Are space camera sensors usually round, or square?
Are there objective criteria for classifying consonance v. dissonance?
Make 1998 using the least possible digits 8
Why is the car dealer insisting on a loan instead of cash?
What is the Radroute bicycle path?
Examples of proofs by making reduction to a finite set
Linq Expression Fails when I use OrderBy property.Length or mix Include,OrderBy and AutoMapper ProjectTo Clause
Many nested AggregateExceptionsEntity Framework 7 navigation property is nullEntity Framework Core 1.0.0 Disable Eager/Lazy LoadingInclude() with Wheres clause failingAutomapper Projection with Linq OrderBy child property errorAsp.Net Core Automapper LINQ expressionAutoMapper ProjectTo ignoring .IncludeThe property '' on entity type could not be found since upgrading to EF 2.1Automapper 7.0.1 ProjectTo mismatch types with ef core 2.1.1 linq joinThe LINQ expression could not be translated for base property
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Asp.net MVC Core 2.2 App crashes when a LINQ expression that uses a combination of Include, Orderby
and AutoMapper's ProjectTo<T>
clause. Below is the exception raised by the app.:
Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'Remotion.Linq.Clauses.Expressions.QuerySourceReferenceExpression'.
The behavior of this LINQ expression is unpredictable because at times it works and others it breaks. I have tried both Eager and Lazy loading but still, get the same error.
recordList = await db.SchoolProfile
.Include(i => i.Category)
.Include(i => i.District)
.Include(i => i.SchoolAddress.Address)
.Include(i => i.SchoolAddress.Coordinates)
.OrderBy(o => o.Name.Length)
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
The same error is thrown even without Include
Clause:
recordList = await db.CurricularActivity
.OrderBy(o => o.Activity.Length)
.ProjectTo<CurricularActivityViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
Removing Activity.Length
seems to work but why having it breaks the code but the same query works elsewhere?
I would, therefore, appreciate some guidance in resolving this.
I would greatly appreciate learning why this is happening and understanding how to resolve this such that I can write more efficient and error-free LINQ expressions
asp.net-core entity-framework-core ef-core-2.2 automapper-collections-ef-core
add a comment
|
Asp.net MVC Core 2.2 App crashes when a LINQ expression that uses a combination of Include, Orderby
and AutoMapper's ProjectTo<T>
clause. Below is the exception raised by the app.:
Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'Remotion.Linq.Clauses.Expressions.QuerySourceReferenceExpression'.
The behavior of this LINQ expression is unpredictable because at times it works and others it breaks. I have tried both Eager and Lazy loading but still, get the same error.
recordList = await db.SchoolProfile
.Include(i => i.Category)
.Include(i => i.District)
.Include(i => i.SchoolAddress.Address)
.Include(i => i.SchoolAddress.Coordinates)
.OrderBy(o => o.Name.Length)
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
The same error is thrown even without Include
Clause:
recordList = await db.CurricularActivity
.OrderBy(o => o.Activity.Length)
.ProjectTo<CurricularActivityViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
Removing Activity.Length
seems to work but why having it breaks the code but the same query works elsewhere?
I would, therefore, appreciate some guidance in resolving this.
I would greatly appreciate learning why this is happening and understanding how to resolve this such that I can write more efficient and error-free LINQ expressions
asp.net-core entity-framework-core ef-core-2.2 automapper-collections-ef-core
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24
add a comment
|
Asp.net MVC Core 2.2 App crashes when a LINQ expression that uses a combination of Include, Orderby
and AutoMapper's ProjectTo<T>
clause. Below is the exception raised by the app.:
Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'Remotion.Linq.Clauses.Expressions.QuerySourceReferenceExpression'.
The behavior of this LINQ expression is unpredictable because at times it works and others it breaks. I have tried both Eager and Lazy loading but still, get the same error.
recordList = await db.SchoolProfile
.Include(i => i.Category)
.Include(i => i.District)
.Include(i => i.SchoolAddress.Address)
.Include(i => i.SchoolAddress.Coordinates)
.OrderBy(o => o.Name.Length)
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
The same error is thrown even without Include
Clause:
recordList = await db.CurricularActivity
.OrderBy(o => o.Activity.Length)
.ProjectTo<CurricularActivityViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
Removing Activity.Length
seems to work but why having it breaks the code but the same query works elsewhere?
I would, therefore, appreciate some guidance in resolving this.
I would greatly appreciate learning why this is happening and understanding how to resolve this such that I can write more efficient and error-free LINQ expressions
asp.net-core entity-framework-core ef-core-2.2 automapper-collections-ef-core
Asp.net MVC Core 2.2 App crashes when a LINQ expression that uses a combination of Include, Orderby
and AutoMapper's ProjectTo<T>
clause. Below is the exception raised by the app.:
Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'Remotion.Linq.Clauses.Expressions.QuerySourceReferenceExpression'.
The behavior of this LINQ expression is unpredictable because at times it works and others it breaks. I have tried both Eager and Lazy loading but still, get the same error.
recordList = await db.SchoolProfile
.Include(i => i.Category)
.Include(i => i.District)
.Include(i => i.SchoolAddress.Address)
.Include(i => i.SchoolAddress.Coordinates)
.OrderBy(o => o.Name.Length)
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
The same error is thrown even without Include
Clause:
recordList = await db.CurricularActivity
.OrderBy(o => o.Activity.Length)
.ProjectTo<CurricularActivityViewModel>(mapper.ConfigurationProvider)
.ToListAsync();
Removing Activity.Length
seems to work but why having it breaks the code but the same query works elsewhere?
I would, therefore, appreciate some guidance in resolving this.
I would greatly appreciate learning why this is happening and understanding how to resolve this such that I can write more efficient and error-free LINQ expressions
asp.net-core entity-framework-core ef-core-2.2 automapper-collections-ef-core
asp.net-core entity-framework-core ef-core-2.2 automapper-collections-ef-core
edited Mar 28 at 8:44
Aarif
6277 silver badges18 bronze badges
6277 silver badges18 bronze badges
asked Mar 28 at 8:05
yaddlyyaddly
287 bronze badges
287 bronze badges
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24
add a comment
|
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24
add a comment
|
1 Answer
1
active
oldest
votes
Apparently the order of expression matters the most, I have this working without errors @Lucian Bargaoanu, thank you for the link to automapper documentation. Always start with Projection using ProjectTo<T>
followed by LINQ
expression.
recordList = await db.SchoolProfile
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.OrderBy(o => o.SchoolName)
.ToListAsync();
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, thoseInclude()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.
– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works withoutInclude()
clause, however the error is raised when I do.OrderBy(o => o.SchoolName.Length)
. If I remove.Length
it works just fine. So I remain baffled by this.
– yaddly
Apr 2 at 14:36
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392718%2flinq-expression-fails-when-i-use-orderby-property-length-or-mix-include-orderby%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Apparently the order of expression matters the most, I have this working without errors @Lucian Bargaoanu, thank you for the link to automapper documentation. Always start with Projection using ProjectTo<T>
followed by LINQ
expression.
recordList = await db.SchoolProfile
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.OrderBy(o => o.SchoolName)
.ToListAsync();
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, thoseInclude()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.
– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works withoutInclude()
clause, however the error is raised when I do.OrderBy(o => o.SchoolName.Length)
. If I remove.Length
it works just fine. So I remain baffled by this.
– yaddly
Apr 2 at 14:36
add a comment
|
Apparently the order of expression matters the most, I have this working without errors @Lucian Bargaoanu, thank you for the link to automapper documentation. Always start with Projection using ProjectTo<T>
followed by LINQ
expression.
recordList = await db.SchoolProfile
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.OrderBy(o => o.SchoolName)
.ToListAsync();
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, thoseInclude()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.
– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works withoutInclude()
clause, however the error is raised when I do.OrderBy(o => o.SchoolName.Length)
. If I remove.Length
it works just fine. So I remain baffled by this.
– yaddly
Apr 2 at 14:36
add a comment
|
Apparently the order of expression matters the most, I have this working without errors @Lucian Bargaoanu, thank you for the link to automapper documentation. Always start with Projection using ProjectTo<T>
followed by LINQ
expression.
recordList = await db.SchoolProfile
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.OrderBy(o => o.SchoolName)
.ToListAsync();
Apparently the order of expression matters the most, I have this working without errors @Lucian Bargaoanu, thank you for the link to automapper documentation. Always start with Projection using ProjectTo<T>
followed by LINQ
expression.
recordList = await db.SchoolProfile
.ProjectTo<SchoolProfileViewModel>(mapper.ConfigurationProvider)
.OrderBy(o => o.SchoolName)
.ToListAsync();
edited Apr 2 at 14:34
answered Mar 28 at 12:20
yaddlyyaddly
287 bronze badges
287 bronze badges
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, thoseInclude()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.
– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works withoutInclude()
clause, however the error is raised when I do.OrderBy(o => o.SchoolName.Length)
. If I remove.Length
it works just fine. So I remain baffled by this.
– yaddly
Apr 2 at 14:36
add a comment
|
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, thoseInclude()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.
– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works withoutInclude()
clause, however the error is raised when I do.OrderBy(o => o.SchoolName.Length)
. If I remove.Length
it works just fine. So I remain baffled by this.
– yaddly
Apr 2 at 14:36
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
In EF6 it works without the Include-s. I'm not sure about EF Core, but try it :)
– Lucian Bargaoanu
Mar 28 at 12:28
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
@LucianBargaoanu I think EF6 has Lazy-Loading turned on by default and that's not the case with EF-Core, with ef-core you need to add Microsoft.EntityFrameworkCore.Proxies package and you can activate it globally in ConfigureServices on DBcontext options as follows : options.UseLazyLoadingProxies or use the context instance to turn it on and off as follows : dbcontext.ChangeTracker.LazyLoadingEnabled = Boolean value. So for now, EagerLoading using Includes is a convenient option for me.
– yaddly
Mar 28 at 12:45
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Lazy loading is not relevant here. Look at the execution plan. By default ProjectTo will fetch everything in your view model. That's why Include is not needed.
– Lucian Bargaoanu
Mar 28 at 13:00
Unless you actually map to types that contain real database entity types, those
Include()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.– poke
Mar 30 at 14:18
Unless you actually map to types that contain real database entity types, those
Include()
calls don’t actually do anything, so you can just get rid of them. No idea why it would break if you do use them in a certain order though.– poke
Mar 30 at 14:18
Thank you for the kind feedback, I can confirm that it works without
Include()
clause, however the error is raised when I do .OrderBy(o => o.SchoolName.Length)
. If I remove .Length
it works just fine. So I remain baffled by this.– yaddly
Apr 2 at 14:36
Thank you for the kind feedback, I can confirm that it works without
Include()
clause, however the error is raised when I do .OrderBy(o => o.SchoolName.Length)
. If I remove .Length
it works just fine. So I remain baffled by this.– yaddly
Apr 2 at 14:36
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392718%2flinq-expression-fails-when-i-use-orderby-property-length-or-mix-include-orderby%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Most likely an EF Core issue. Check the execution plan. Run that as a LINQ statement, without AM. You should get the same result.
– Lucian Bargaoanu
Mar 28 at 9:40
@LucianBargaoanu thank you for the link, the order of execution has an impact, so I changed the query to do projection first and then LINQ expression and it worked as expected.
– yaddly
Mar 28 at 12:24