The associated code is:System.NullReferenceException: De objectverwijzing is niet op een exemplaar van een object ingesteld.
bij Devart.Data.Linq.Provider.g.a(bg A_0)
bij Devart.Data.Linq.Provider.h.a(bg A_0)
bij Devart.Data.Linq.Provider.g.a(SqlExpression A_0)
bij Devart.Data.Linq.Provider.g.a(SqlExpression A_0, Boolean A_1)
bij Devart.Data.Linq.Provider.n.a(IDataServices A_0, SqlExpression A_1, Boolean A_2)
bij Devart.Data.Linq.Provider.n.a(IDataServices A_0, SqlExpression A_1)
bij Devart.Data.Linq.Provider.n.a(Type A_0, SqlExpression A_1, IDataServices A_2)
bij Devart.Data.Linq.Provider.DataProvider.CompiledQuery.GetReaderFactory(List`1 elementInstanceTypes, IDataServices services, SqlNode query)
bij Devart.Data.Linq.Provider.DataProvider.CompiledQuery..ctor(QueryInfo queryInfo, IDataServices services, Boolean isQueryObjectByKey, Object queryObjectKey)
bij Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query)
bij Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query)
bij Devart.Data.Linq.DataQuery`1.i()
bij System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bij System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bij Jumbo.Juist.Models.Data.DAL.Search(DateTime dt) in D:\Projects\JUIST\Juist\Juist\Models\Data\DAL.cs:regel 54
bij Jumbo.Juist.Controllers.ZoekenController.Index(String date) in D:\Projects\JUIST\Juist\Juist\Controllers\ZoekenController.cs:regel 47
bij lambda_method(ExecutionScope , ControllerBase , Object[] )
bij System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
bij System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
bij System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
bij System.Web.Mvc.ControllerActionInvoker.c__DisplayClassd.b__a()
bij System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
bij System.Web.Mvc.ControllerActionInvoker.c__DisplayClassd.c__DisplayClassf.b__c()
bij System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
bij System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
Code: Select all
///
/// Search based on the given Date
///
///
///
public static SearchResult Search(DateTime dt)
{
IQueryable iq =
// var xxx =
from rd in AppDataContext.GetInstance().RouteDags
join b in AppDataContext.GetInstance().Bezorgings on rd.Id equals b.RouteDag
join h in AppDataContext.GetInstance().Hubs on b.Hub equals h.Id into hjoined
from hj in hjoined.DefaultIfEmpty()
where rd.Datum == dt
orderby rd.Vertrektijd.TimeOfDay, rd.Routenummer, b.Winkelnummer
//select new {rd, b, hjoined, hj};
select new SearchResultItem
{
Naam = String.IsNullOrEmpty(hj.Code) ? b.Winkelnaam : "Via " + hj.Code + ": " + b.Winkelnaam,
Winkelnummer = b.Winkelnummer,
Routenummer = rd.Routenummer,
Vertrektijd = rd.Vertrektijd,
Levertijd = b.Levertijd,
Prognose = b.Prognose,
Chauffeur = rd.Chauffeur,
Configuratie = rd.Configuratie,
Voertuignummer = rd.Voertuignummer,
AankomstDC = rd.AankomstDc,
VertrekDC = rd.VertrekDc,
RouteDagId = rd.Id,
BezorgingId = b.Id
};
//var y = xxx.ToList();
//return null;
SearchResult sr = new SearchResult(iq.ToList(), dt);
return sr;
}
Hope you can help fixing this.