Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8099535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:26:14+00:00 2026-06-05T22:26:14+00:00

I have these objects: public class Class { public Guid Id {get;set;} public string

  • 0

I have these objects:

public class Class
{
     public Guid Id {get;set;}
     public string Name {get;set;}
     public virtual ICollection<Schedule> Schedules{get;set;}
}

public class Schedule
{
     public Guid Id {get;set;}
     public virtual DayOfTheWeekId {get;set;}
     public virtual DayOfTheWeek {get;set;}
     public DateTime StartTime {get;set;}
     public DateTime EndTime {get;set;}
}

My current query looks like this, but I get this exception: At least one object must implement IComparable.:

    Repository
.Get(c => c.Schedules.Any(s => s.DayOfTheWeekTypeId == dayOfTheWeekId))
.OrderBy(e => e.Schedules.OrderBy(s => s.StartDateTime)).ToList()

when I set the times i always use the same day, because I need to show classes on certain days of the week. That is where the DayOfTheWeek object comes into play. This is how I am setting the times:

var schedule = new Schedule{
                           StartDateTime = new DateTime(1999,1,1) + new TimeSpan(9, 15, 0),
                           EndDateTime = new DateTime(1999,1,1) + new TimeSpan(9, 15, 0),
                           DayOfTheWeekTypeId = 1
                           }

Update:

Thinking about this, I guess I may want grouping…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:26:16+00:00Added an answer on June 5, 2026 at 10:26 pm

    You’re trying to order by a sequence. What does that even mean?

    It would make more sense to order by – say – the earliest event in the schedule:

    .OrderBy(e => e.Schedules.Min(s => s.StartDateTime))
    

    I don’t know whether that will work, but it at least makes more sense. (It would work in LINQ to Objects. I have no idea about EF though.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these two classes: class Student { String name; String age ; }
I have the following class public class OrderItem { public Guid ID { get;
If I have the following domain object: public class Customer { public virtual Guid
I have these code in my views.py: array = [] p = Person.objects.filter(client=1,status='Complete').values('name', 'age',
I have a IRecord object that can hold objects. The name of these objects
I have a repository class that defines some basic Get/Save/Delete methods. Inside these, I
I have an Object named Item: public class Item { public Guid Id {
I have a list of custom objects. These objects have 2 datetime properties on
I have an array of pointers to Objective-C objects. These objects have a sort
I have an array made of unlimited number of objects. These objects have the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.