So this is easily reproduced at the demo site. The problem is that if Save button clicked for existing entity, and this entity has an empty DateTime field, the entity will not be saved, the DateTime field will be automatically set to 1/1/0001 12:00 AM and the following error will be displayed:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Reproduction Steps
To reproduce this, go to the following record http://admin.ilaro.net/Admin/Order/Edit/10249 and clear out Shipped Date field, then try to save the entity. The error will be displayed.
Analysis
This error arises in the Ilaro.Admin.Core.EntityRecordCreator class in GetPropertyValue method at the line 40:
Peek:
var value = valueProvider.GetValue(property.Name);
Here valueProvider is of type System.Web.Mvc.FormCollection, and GetValue instead of null value (the date is null in the FormCollection itself), returns an empty string. And later on, DateTime.TryParse instead of working with null, is parsing an empty string.
Description
So this is easily reproduced at the demo site. The problem is that if Save button clicked for existing entity, and this entity has an empty DateTime field, the entity will not be saved, the DateTime field will be automatically set to 1/1/0001 12:00 AM and the following error will be displayed:
Reproduction Steps
To reproduce this, go to the following record http://admin.ilaro.net/Admin/Order/Edit/10249 and clear out Shipped Date field, then try to save the entity. The error will be displayed.
Analysis
This error arises in the Ilaro.Admin.Core.EntityRecordCreator class in GetPropertyValue method at the line 40:
Peek:
var value = valueProvider.GetValue(property.Name);
Here valueProvider is of type System.Web.Mvc.FormCollection, and GetValue instead of null value (the date is null in the FormCollection itself), returns an empty string. And later on, DateTime.TryParse instead of working with null, is parsing an empty string.