programmerist 1983
asked on
How can I use Fetch expression delegate method instead of skip and take for better performance in Linq query?
I have a big trouble with my skip take expression in my linq query. When I am looking for an advise , I found that a solution. But I couldn't use it.It created an error like below. How can I solve my issue ? I want to use delegate method like "myQuery.Skip(() => skip).Take(() => take); "that in .NET CORE.
Please look at this article: https://visualstudiomagazine.com/articles/2016/12/06/skip-take-entity-framework-lambda.aspx They claim that "myQuery.Skip(() => skip).Take(() => take);" has faster than "myQuery.Skip(skip).Take(t ake);" but I got error when appliying delegate versin skip-take method.
Package System.Data.Entity.Reposit ory 2.0.0.1 was restored using .netframework instead of the project target framework .netcoreapp v 2.2. this package may not be fully compatible with your project
Error Detail :
Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.EntityFramework Core.Entit yFramework QueryableE xtensions. Include<TE ntity, TProperty>(System.Linq.IQu eryable<TE ntity>,
System.Linq.Expressions.Ex pression<S ystem.Func <TEntity, TProperty>>)' and 'System.Data.Entity
Please look at this article: https://visualstudiomagazine.com/articles/2016/12/06/skip-take-entity-framework-lambda.aspx They claim that "myQuery.Skip(() => skip).Take(() => take);" has faster than "myQuery.Skip(skip).Take(t
Package System.Data.Entity.Reposit
using System.Data.Entity
int skip = 5;
int take = 10;
myQuery.Skip(() => skip).Take(() => take);
Error Detail :
Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.EntityFramework
System.Linq.Expressions.Ex
I think you are trying to employee EntityFrameworkCore (6) Skip & Take methods which are ambiguous with System.Linq. Try to remove using System.Linq statement.
ASKER
Thank you your answer but when I remove System.Linq, WHERE clauses throws :
Severity Code Description Project File Line Suppression State
Error CS1660 Cannot convert lambda expression to type 'string' because it is not a delegate type
Severity Code Description Project File Line Suppression State
Error CS1660 Cannot convert lambda expression to type 'string' because it is not a delegate type
Could it possible to post portions of your code here, especially where you got the errors?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.