This question is locked. New answers and comments are not allowed.
With This code :
I have this exception :
It's port of MvcMusicStore database from MSSQL to PostgreSQL database.
private
List<Album> GetTopSellingAlbums(
int
count)
{
// Group the order details by Album and return
// the albums with highest count
return
storeDB.Albums
.OrderByDescending(a => a.OrderDetails.Count())
.Take(count)
.ToList();
}
I have this exception :
System.InvalidOperationException was unhandled by user code
Message=An exception occured during the execution of '
Extent<MyMVC.Album>.OrderByDescending(a => a.OrderDetails.Count()).Take(1)'. See InnerException
for
more details.
Source=Telerik.OpenAccess.35.Extensions
StackTrace:
at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single)
at Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQuery[T](Piece`1 piece, Object[] grpVals)
at Telerik.OpenAccess.Query.Piece`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at MyMVC.Controllers.HomeController.GetTopSellingAlbums(Int32 count)
in
C:\Users\Michael\Documents\Visual Studio 2010\Projects\MyMVC\MyMVC\Controllers\HomeController.cs:line 29
at MyMVC.Controllers.HomeController.Index()
in
C:\Users\Michael\Documents\Visual Studio 2010\Projects\MyMVC\MyMVC\Controllers\HomeController.cs:line 19
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassd.<InvokeActionMethodWithFilters>b__a()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException: System.NullReferenceException
Message=Object reference not
set
to an instance of an
object
.
Source=Telerik.OpenAccess.35.Extensions
StackTrace:
at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQueryImpl(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single)
at Telerik.OpenAccess.Query.ExpressionCompiler.PerformDatabaseQuery(Type type, Int32 elementAt, Object[] groupResolutionParamValues, Boolean single)
InnerException:
It's port of MvcMusicStore database from MSSQL to PostgreSQL database.