We have added a new column to the database table. The column is defined as follows:
Name: DisplayAsSoldOut
Type: Boolean
NOT NULLABLE
Default Value: 0
We updated our EDMX data model and the new column looks just fine. We work on the ASP.NET 4.0 platform using C #.
We have a class defined as a PagedList that inherits the IPagedList interface from List and implenents
In PagedList we have the following method:
protected void Initialize(IQueryable<T> source, int index, int pageSize, int? totalCount)
{
if (index < 0)
{ throw new ArgumentOutOfRangeException("PageIndex cannot be below 0."); }
if (pageSize < 1)
{ throw new ArgumentOutOfRangeException("PageSize cannot be less than 1."); }
if (source == null)
{ source = new List<T>().AsQueryable(); }
if (!totalCount.HasValue)
{ TotalItemCount = source.Count(); }
PageSize = pageSize;
PageIndex = index;
if (TotalItemCount > 0)
{ PageCount = (int)Math.Ceiling(TotalItemCount / (double)PageSize); }
else
{ PageCount = 0; }
HasPreviousPage = (PageIndex > 0);
HasNextPage = (PageIndex < (PageCount - 1));
IsFirstPage = (PageIndex <= 0);
IsLastPage = (PageIndex >= (PageCount - 1));
if (TotalItemCount > 0)
{ AddRange(source.Skip((index) * pageSize).Take(pageSize).ToList()); }
}
When we reach the following line:
{ AddRange(source.Skip((index) * pageSize).Take(pageSize).ToList()); }
we get the following exception ...
Type: System.Data.EntityCommandExecutionException
Inner Exception: "Invalid column name 'DisplayAsSoldOut'."
I tried looking for this type of exception, but to no avail. The column displayed in the EDMX dataset is just fine. I even created a small throwaway program and imported EDMX for easy reading from the database, and it worked fine. Does anyone come across something similar?
, .