none
Code First - How to make DateTime columns nullable RRS feed

  • Question

  • I've made a newbie project using Code First and MVC. When it created my database, it made most of the columns nullable, except the DateTime columns.

    How do I set the DateTime columns nullable/optional?

    (I googled this but didn't find the answer)

     

    Tuesday, November 8, 2011 6:01 PM

Answers

  •  

    When you code the class declare the DateTime field as DateTime? and NOT DateTime.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, November 8, 2011 6:21 PM

All replies

  •  

    When you code the class declare the DateTime field as DateTime? and NOT DateTime.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
    Tuesday, November 8, 2011 6:21 PM
  • Thanks

    I'll check it out

    Tuesday, November 8, 2011 9:02 PM