Copied to clipboard

Flag this post as spam?

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


  • Phil Dye 149 posts 325 karma points
    Jan 11, 2012 @ 17:34
    Phil Dye
    0

    Dynamic{string} from content picker node in 4.7.1.1

    I'm testing an upgrade to 4.7.1.1 on a recently built site, and getting errors in several macroScripts;

    The best overloaded method match for 'umbraco.library.NiceUrl(int)' has some invalid arguments

    because the int in question is now being typed as a dynamic{string}, previously a dynamic{int}.

    I can see some stuff in the commit logs referring to new RazorDataTypeModel stuff, but not sure if this relevant or how to use it?

    I've tried something like this in umbracoSettings.config, but it's not working;

    <mapping documentTypeAlias="Sidepanel" nodeTypeAlias="linkToPage">umbraco.MacroEngines.RazorDataTypeModels.IntegerDataTypeModel,umbraco.MacroEngines</mapping>

    (Sidepanel is the document type, and linkToPage is the alias of the content picker)

    Phil

  • Phil Dye 149 posts 325 karma points
    Jan 11, 2012 @ 18:02
    Phil Dye
    0

    Turning on umbDebugShowTrace gives;

     

    RazorDynamicNode got datatype 158aa029-24ed-4948-939e-c3da209e5fba for linkToPage on Sidepanel0.20785668787030.000033
    Checking for a RazorDataTypeModel for data type guid 158aa029-24ed-4948-939e-c3da209e5fba...0.2078890245661370.000032
    Checking the RazorDataTypeModelTypes static mappings to see if there is a static mapping...0.2079141753295650.000025
    There isn't a staticMapping defined so checking the RazorDataTypeModelTypes cache...0.2081359126724430.000222
    GUID 158aa029-24ed-4948-939e-c3da209e5fba does not have a DataTypeModel, falling back to ConvertPropertyValueByDataType0.2082170110524770.000081

    Presumably ConvertPropertyValueByDataType is (wrongly) typing the int of the Content Picker to a string?

     

     

  • Gareth Evans 143 posts 335 karma points c-trib
    Jan 12, 2012 @ 22:46
    Gareth Evans
    101

    Hi Phil

    What is the data type of that property? Content Picker?
    Is it always going to be a single number?

    Indeed that parsing was changed so that it didn't upcast when it shouldn't.

    Your mapping is almost right but the nodeTypeAlias is intended to be the alias of the node (e.g. in your case Sidepanel) and the document type alias is the property alias (linkToPage). Sorry for the confusing attribute names, I thought I had them clear enough (nodeTypeAlias being what the alias of the document type is usually referred to.

    I'll add propertyTypeAlias in 4.7.2 (without breaking documentTypeAlias) so that this becomes clear. Sorry again!

    If you flip these around, the static mapping should apply. In the next release I'll add the GUID for content picker.

    Gareth

  • Phil Dye 149 posts 325 karma points
    Jan 13, 2012 @ 11:36
    Phil Dye
    0

    Thanks Gareth; the property is indeed a standard Content Picker.

    I was perhaps mislead by the commented out example;

    <mapping documentTypeAlias="textPage" nodeTypeAlias="propertyAlias">

    so it might be worth clarifying those examples for a later release.

    In any event, rather than mapping on the nodeTypeAlias (since I think there are other Content Pickers I've not found yet), I'm now mapping on the dataTypeGuid, which is working fine. (I may have also fallen foul of not touching the web.config whilst trying this yesterday, since this stuff seems to be cached at app start).

    Phil

  • James Drever 118 posts 149 karma points
    Jan 20, 2012 @ 13:29
    James Drever
    2

    I had exactly the same problem, thanks Phil for the suggested fix.

    Just to be clear about the fix, I amended the following section in umbracoSettings.config (added in 4.7.1.1), within <scripting><razor>, to add the mapping for the content picker GUID: 

              <dataTypeModelStaticMappings>
                <mapping dataTypeGuid="158aa029-24ed-4948-939e-c3da209e5fba">umbraco.MacroEngines.RazorDataTypeModels.IntegerDataTypeModel,umbraco.MacroEngines</mapping>
               <!-- 
            <mapping documentTypeAlias="textPage" nodeTypeAlias="propertyAlias">Fully.Qualified.Type.Name.For.ModelBinder,Assembly.Name.Excluding.Dot.Dll</mapping>
                <mapping dataTypeGuid="00000000-0000-0000-0000-000000000000" documentTypeAlias="textPage" nodeTypeAlias="propertyAlias">Fully.Qualified.Type.Name.For.ModelBinder,Assembly.Name.Excluding.Dot.Dll</mapping>
                <mapping dataTypeGuid="00000000-0000-0000-0000-000000000000" documentTypeAlias="textPage">Fully.Qualified.Type.Name.For.ModelBinder,Assembly.Name.Excluding.Dot.Dll</mapping>
                <mapping dataTypeGuid="00000000-0000-0000-0000-000000000000" nodeTypeAlias="propertyAlias">Fully.Qualified.Type.Name.For.ModelBinder,Assembly.Name.Excluding.Dot.Dll</mapping>
                <mapping nodeTypeAlias="propertyAlias">Fully.Qualified.Type.Name.For.ModelBinder,Assembly.Name.Excluding.Dot.Dll</mapping>
                -->
              </dataTypeModelStaticMappings>

    James.

Please Sign in or register to post replies

Write your reply to:

Draft