Linq2Umbraco - Error when datetime value is not set
I'm running umbraco 4.5.2 (.NET 3.5 version) on a project, and I'm trying out linq2umbraco to retrieve entities which contain a datetime field. The scenario is that the datetime field on the document type is not mandatory, and when the field is not set, linq2umbraco fails since it cannot parse an empty datetime.
"base {System.SystemException} = {"String was not recognized as a valid DateTime."}" .
I've tried playing with the umbraco.config file and fillling in this value manually for the given node, and linq2umbraco is now able to retrieve all the entities as specified. However, according to http://our.umbraco.org/forum/core/41-feedback/11237-LINQ-to-Umbraco-optional-structs?p=1 this bugshould have been fixed , however it still seems to be present in the 4.5.2 (.NET 3.5) umbraco version on codeplex.
I think i have tracked down the error. The model did indeed not contain a nullable datetime, so that means the field must have been set to mandatory, without the documents in question being resaved. Thanks for your help slace!
Linq2Umbraco - Error when datetime value is not set
I'm running umbraco 4.5.2 (.NET 3.5 version) on a project, and I'm trying out linq2umbraco to retrieve entities which contain a datetime field. The scenario is that the datetime field on the document type is not mandatory, and when the field is not set, linq2umbraco fails since it cannot parse an empty datetime.
"base {System.SystemException} = {"String was not recognized as a valid DateTime."}" .
I've tried playing with the umbraco.config file and fillling in this value manually for the given node, and linq2umbraco is now able to retrieve all the entities as specified. However, according to http://our.umbraco.org/forum/core/41-feedback/11237-LINQ-to-Umbraco-optional-structs?p=1 this bugshould have been fixed , however it still seems to be present in the 4.5.2 (.NET 3.5) umbraco version on codeplex.
What would be the best way to resolve this?
Anders
Is your property in the generated file a Nullable<DateTime>? This is determined by the Mandatory option on the doc type property.
If it is mandatory then it wont generate a nullable property, and then result in an error
I think i have tracked down the error. The model did indeed not contain a nullable datetime, so that means the field must have been set to mandatory, without the documents in question being resaved. Thanks for your help slace!
is working on a reply...