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 9153833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:13+00:00 2026-06-17T12:20:13+00:00

I am using the code first approach and want to create a table called

  • 0

I am using the code first approach and want to create a table called Classes. This table will hold the following information:

  • Name (Math 1)
  • Code (MatA)
  • Subject (Mathmatics)
  • Description (Math is fun)
  • BeginTime (DateTime)
  • EndTime (DateTime)
  • BeginDate (DateTime)
  • EndDate (DateTime)

In addition to the above, I would like to assign the days a class will happen:

  • Name (Math 1)
  • Code (MatA)
  • Subject (Mathmatics)
  • Description (Math is fun)
  • BeginTime (DateTime)
  • EndTime (DateTime)
  • BeginDate (DateTime)
  • EndDate (DateTime)
  • Monday (bool)
  • Tuesday (bool)
  • etc.

I do not want to do the above, it just seems inefficient, especially when I need to call a class depending on the current date (ie. Get all classes that appear on Monday).

So, what kind of table structure should I have?

Thanks

  • 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-17T12:20:13+00:00Added an answer on June 17, 2026 at 12:20 pm

    You should create 2 tables, 1 for Classes and 1 for ClassSchedules. Join your tables with a ClassId column.

    BTW, you shouldn’t need 2 columns for BeginTime and BeginDate, those should be stored in the same column — same goes for EndTime and EndDate.

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

Sidebar

Related Questions

I'm using the Code First approach and have the following Model: public class Person
I'm using the Code First approach to build the database in this problem. I
in my current project I'm using code first approach. I have a type called
I am using the latest Entity Framework with a code-first approach to create a
We are using EF 4.0 with code first approach. I have defined constraint for
I'm building a layered application using Entity Framework code first approach with an mvc4
What should I use as MetaData while I'm using Code-First Approach via EntityConnectionStringBuilder EntityConnectionStringBuilder
I'm using Entity Framework 4.1's code first approach to map a class hierarchy to
When adding a new non-nullable column to a table using code first migrations, it
I'm using Code First with EF 5. Currently I have SPs that return just

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.