Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anders Rørvik 25 posts 47 karma points
    Feb 02, 2011 @ 11:53
    Anders Rørvik
    0

    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

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Feb 03, 2011 @ 00:43
    Aaron Powell
    0

    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

  • Anders Rørvik 25 posts 47 karma points
    Feb 03, 2011 @ 09:44
    Anders Rørvik
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft