Skip to content

Use of ToString() passed through to provider #5

Description

@kierenj

To investigate and dig into this issue with the below code.

var query = Context.Inspectors
                .Where(i => !i.IsDeleted && i.FieldEvaluationRelevantJobs.Any() && i.FieldEvaluationPendingDate != null);

            if (search != null)
            {
                query = query.Where(i => i.User.Person.FirstName.Contains(search) || i.User.Person.LastName.Contains(search));
            }

            results.Total = query.Count();

            query = query.OrderBy(i => i.FieldEvaluationPendingDate.Value); // order before taking the top
            query = query.Take(50);

            var fieldEvals = query.Select(i => new InspectorFieldEvaluationsDto
                {
                    Name = i.User.Person.DisplayName,
                    InspectorId = i.Id,
                    Reason = i.FieldEvaluationReason,
                    DueDate = i.FieldEvaluationPendingDate.Value,
                    Status = "Pending since " + i.FieldEvaluationPendingDate.Value.ToString("dd-MMM-yyyy"),
                    RelevantJobs = i.FieldEvaluationRelevantJobs.Count(),
                    Jobs = i.FieldEvaluationRelevantJobs.Select(j => new FieldEvaluationJobsDto
                    {
                        Client = j.Project.Client.Name,
                        ClientId = j.Project.ClientId,
                        Job = j.Code,
                        JobId = j.Id,
                        Project = j.Project.Name,
                        ProjectId = j.ProjectId,
                        PlaceOfInspection = j.Site.Name,
                        PlaceOfInspectionId = j.SiteId,
                        Coordinator = j.CoordinatingOfficeCoordinator.DisplayName,
                        CoordinatorId = j.CoordinatingOfficeCoordinatorId
                    }).ToList()
                }).ThenDoDeferred(new LinqDeferConfiguration(() => new LinqDefer.ExpressionAnalysers.DataAccessOnly.DataAccessOnlyAnalyser()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions