iorderedqueryable

Cannot convert IQueryable<> to IOrderedQueryable error

早过忘川 提交于 2019-12-19 05:14:47
问题 I have the following LINQ code: var posts = (from p in db.Posts .Include("Site") .Include("PostStatus") where p.Public == false orderby p.PublicationTime select p); if (!chkShowIgnored.Checked) { posts = posts.Where(p => p.PostStatus.Id != 90); } That last line (the extra where) is giving me the error: Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Linq.IOrderedQueryable'. I'm not sure what this means... Why am I getting this error? It appeared once I added the "orderby"

Dynamic Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> Expression

随声附和 提交于 2019-12-06 02:02:33
问题 I am using patterns mentioned here http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application And i am using method below to query EF public virtual IEnumerable<TEntity> Get( Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = "") { IQueryable<TEntity> query = dbSet; if (filter != null) { query = query.Where

Dynamic Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> Expression

﹥>﹥吖頭↗ 提交于 2019-12-04 07:22:07
I am using patterns mentioned here http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net-mvc-application And i am using method below to query EF public virtual IEnumerable<TEntity> Get( Expression<Func<TEntity, bool>> filter = null, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null, string includeProperties = "") { IQueryable<TEntity> query = dbSet; if (filter != null) { query = query.Where(filter); } foreach (var includeProperty in includeProperties.Split (new char[] { ',' }, StringSplitOptions

Cannot convert IQueryable<> to IOrderedQueryable error

假装没事ソ 提交于 2019-12-01 02:47:59
I have the following LINQ code: var posts = (from p in db.Posts .Include("Site") .Include("PostStatus") where p.Public == false orderby p.PublicationTime select p); if (!chkShowIgnored.Checked) { posts = posts.Where(p => p.PostStatus.Id != 90); } That last line (the extra where) is giving me the error: Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Linq.IOrderedQueryable'. I'm not sure what this means... Why am I getting this error? It appeared once I added the "orderby" clause to the query, before that it compiled fine, so I have kind of a hunch of what is going on, but I