Copied to clipboard

Flag this post as spam?

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


  • Chris Sprague 11 posts 31 karma points
    May 10, 2012 @ 11:48
    Chris Sprague
    0

    Breaking Change in DynamicNode?

    I'm not sure if this is actually a breaking change from a more recent release, but it appears that DynamicNode returns a string with node Id instead of an int of node Id when invoked dynamically.

    This breaks anywhere where we've used type casting to move out of DLR.

     

    Has anybody experienced this? Is this a 4.7.1 to 4.7.2 issue?

  • Chris Sprague 11 posts 31 karma points
    May 10, 2012 @ 11:49
    Chris Sprague
    0

    EDIT: This is when accessing a content picker value

  • Chris Sprague 11 posts 31 karma points
    May 11, 2012 @ 09:16
    Chris Sprague
    0

    As nobody's commented on this yet I'll add a bit more context for the google searchers.

    The problem presents itself when you attempt to cast what was previously a dynamically returned int back into a non-dynamic int. The error you'll see on your website looks like this;

    Error loading Razor Script 
    Cannot convert type 'string' to 'int'

    This error message won't be limited to the problem in this thread, but in this case, the problem can be fixed by looking for the following pattern, and resolving it. The 'LatestNewsNode' generic property is a 'Content Picker':

     new DynamicNode((int)Model.LatestNewsNode)

    To correct, change to:

    new DynamicNode((string)Model.LatestNewsNode)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    May 11, 2012 @ 10:26
    Jeroen Breuer
    0

    This change was made between 4.7.1 and 4.7.1.1. You can fix it for the content picker by going to umbracoSettings.Config and add this:

    <dataTypeModelStaticMappings>
      <mapping dataTypeGuid="158aa029-24ed-4948-939e-c3da209e5fba">umbraco.MacroEngines.RazorDataTypeModels.IntegerDataTypeModel,umbraco.MacroEngines</mapping>
    </dataTypeModelStaticMappings>

    Than the content picker will be an int again.

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft