score:0
change it into an iorderedqueryable<t>
by calling .orderby()
before skip
and take
. i think it's currently retrieving all rows from the table. normally i'd have expected an exception to be thrown but i'm not sure why it's not been - are you using the results? have you tried running it with a page > 0?
try this:
var results;
if (facilityid != guid.empty)
{
results = context.calllists.where(c => c.agencyid == agencyid).orderby(c => c.something);
}
else
{
results = context.calllists.where(c => c.agencyid == agencyid && c.initiatedfacilityid == facilityid).orderby(c => c.something);
}
if (request.page > 0)
{
results = results.skip((request.page - 1) * request.pagesize);
}
return results.take(request.pagesize);
in addition to this, you need to come up with a way of handling the sql azure transient errors. this is basically a subset of errors that can be thrown when executing queries in sql azure, which should be handled by waiting and retrying the operation, usually with increasing wait times between retries until you finally accept a failure. read more about it here and here.
Source: stackoverflow.com
Related Query
- Entity Framework Code First ToList method timing out on SQL Azure
- SQL subquery result in LINQ and Entity Framework Code First
- most efficient Entity Framework Code First method of flattening / projecting parent entity with specific child
- Does Linq in Entity Framework code first use SQL or does it get the whole table first?
- Entity Framework 6 Code First Custom Functions
- Entity Framework Code First without app.config
- Query Xml from SQL using Entity Framework Database First
- Entity Framework Code First using context in Controller
- many to many mapping in entity framework code first
- How to apply the SQL in keyword in Entity Framework method syntax?
- How to Create a Run-Time Computed (NotMapped) Value in Entity Framework Code First
- updating data in many-to-many relationship in entity framework in code first existing database
- Entity Framework LINQ query starts timing out - speeds up again after DB server reboot
- Entity Framework Code First String Comparison with Oracle Db
- Entity Framework Code First - Get blog posts which have certain tags
- How to Query Icollections of Entity Framework Code First Data
- Entity Framework code first - Many to Many - Include conditional
- How to make a property unique in Entity Framework Code First
- Entity Framework Code First override onModelCreating() for TPT Inheritance Screwing Up Identity User and Role Models
- How to loop through a child list of objects in Entity Framework 4.1 code first
- How can I convert Sql query to Linq and its equivalent with Join() method in Entity Framework Core
- how to select data by linq in many-to-many relationship in First code Entity framework 5
- Why Entity Framework Code First one to many Doesn't work properly
- LINQ - Entity framework code first - Grouped results to custom class
- Equivalent sql code insert/sql in entity framework in code-first
- map one to one with multiple primary key columns entity framework code first
- Fixing Loop Reference in Entity Framework Code First when Serializing to Json
- IQueryable two tables from Code First Entity Framework
- Entity Framework Code First Select Item Based on Relationship
- Entity Framework ToList Method TSource
More Query from same tag
- Orderby() not ordering numbers correctly c#
- How do I refactor a common LINQ subquery into a method?
- Joining results from two queries in C# using LINQ or other module
- EF Code first - add collection to a collection, appropriate usage of skip() and take()
- How do I get previous key from SortedDictionary?
- Select one recent row for that record with group by two columns
- Parenthesis Expressions in LINQ to SQL
- Set or update data in LINQ
- How to introduce Let keyword inside Linq statement with Group by
- AP.NET webforms using LINQ to SQL datasource and databind with foreign keys across multiple tables
- Why this Union on two Dictionary doesnt work?
- Removing and adding search filters with Linq
- LINQ Join usage data from two data sets into one
- How to Use String Array All Operator in Linq
- Get distinct results using LINQ GroupBy for complex entity relationships?
- How to handle null tables in linq left join
- Extracting information from xml using XDOCUMENT and LINQ (C#)
- LINQ: Searching inside child entities
- Left Join in VB.NET LINQ
- C#/LINQ select sublist of objects with same properties
- C# LINQ get first list items of a dictionary<string, List<object>>
- How to overload a method to accept a Linq expression
- How do I match two identical database tables with LINQ?
- LINQ Union between two tables with the same fields and then returned in a collection
- Combine several Lists into one, GroupBy certain column, convert each Grouped result into HTML table
- LINQ Query to find minumum value from a grouping - unable to create constant of type 'X'
- LINQ Group By and select collection
- Refactorise Linq query
- LINQ for an SQL with multiple LEFT OUTER JOINS on different tables
- Linq Newbie. Can I write this Linq query more concise?