Thursday, November 6, 2014
Best Practices for Code Review
Labels:
c#,
Code review,
Peer Code Review,
programming
The cast to value type 'Double' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type
var res =(from profile in dbModel.ProfileMasters select new { ProfileID = profile.ProfileId, Profile = profile.ClientName, Tasks= profile.TaskMasters.Count(), AverageTime = profile.TaskMasters.Select(x => EntityFunctions.DiffMinutes(x.StartTime, x.EndTime)).Average(y => (decimal?)y.Value), LastTime = profile.TaskMasters.Max(x=>x.StartTime) }).ToList();
DbArithmeticExpression arguments must have a numeric common type
dgvProfiles.DataSource = (from profile in dbModel.ProfileMasters select new { ProfileID = profile.ProfileId, Profile = profile.ClientName, Tasks= profile.TaskMasters.Count(), AverageTime = profile.TaskMasters.Select(x => EntityFunctions.DiffMinutes(x.StartTime, x.EndTime)).Average(y => (decimal?)y.Value), LastTime = profile.TaskMasters.Max(x=>x.StartTime) }).ToList();
Labels:
ASP.NET,
ASP.NET MVC,
C#.NET,
Lambda Expression,
LINQ
Subscribe to:
Posts (Atom)