SmartDate initial value

SmartDate initial value

Old forum URL: forums.lhotka.net/forums/t/2608.aspx


MonorailMan posted on Thursday, March 29, 2007

I have a number of business objects in my application with date properties.  When an object is created, the CodeSmith template specifies that the date properties should all be initialized to DateTime.Today.  This doesn't work for us, as it can fill in a date for certain fields that no date truly applies for.  For instance, in a customer object, the "Last Invoiced Date" should be blank if the customer has never been invoiced.  Can anyone reccomend the proper way to handle this?

Thank you for your assistance

Rob

JoeFallon1 replied on Friday, March 30, 2007

Keep in mind that you can modify the templates to suit your needs.

I initialize Smart dates like this:

Protected mSomeDate As New SmartDate

Joe

david.wendelken replied on Tuesday, April 03, 2007

JoeFallon1:

Keep in mind that you can modify the templates to suit your needs.

I initialize Smart dates like this:

Protected mSomeDate As New SmartDate

Joe

If you have useful naming conventions ( and follow them!), you can make your templates initialize SmartDate objects differently:

Protected EffectiveDate As New SmartDate(false)

Protected ExpirationDate As New SmartDate(true)

 

Copyright (c) Marimer LLC