I have a property called TerminationDate in my Employee Class that only gets set when the employees employment ends. The initialized property defaults to 01/01/0001 12:00:00 AM and I know I can check this prior to acting upon it but it's got me wondering if I'm missing something that isn't obvious to me. So my question is, how do you guys handle a date that you don't always set? Some of the ways I've played around with are:
- Let the default save to the database and exclude it from any queries
- Use a string instead of a date and parse it when datetime calculations are needed. (don't really like doing this)
- Allow the date field to be null in the database (don't usually like storing null dates) and skip saving the date if it's the default.
So am I missing something simple that I'm not taking into consideration? I've thought about a second class that inherits the Employee class that is nothing more than this termination date. So more or less a TerminatedEmployee class. Is this a good practice?