Copied to clipboard

Flag this post as spam?

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


  • Barry Fogarty 493 posts 1129 karma points
    Sep 17, 2011 @ 15:07
    Barry Fogarty
    0

    Razor messages in trace

    Can anyone explain to me the following messages I get from my razor macros in the trace:

    Checking the RazorDataTypeModelTypes cache to see if the GUID 67db8357-ef57-493e-91ac-936d305e0f2a has a Model...  GUID [id] does not have a DataTypeModel - falling back to ConvertPropertyValueByDataType.

     

    Should I be concerned?  I noticed on one macro where it navigates the tree looking for the closest property to be set, this was taking quite a long time (nearly a second) and was wondering if I could be doing in a way for better performance.  FYI the code:

    var metaDesc = Model.AncestorsOrSelf().Where("metaDescription.ToString() != string.Empty").Last().metaDescription;

    where I look for the closest node that has the metaDescription tag set.

    SO back to my original posting - does it matter that my properties do not have a DataTypeModel?  Shouild I be including a 'using' or inherits in my macro scripts to help performance?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Sep 19, 2011 @ 13:11
    Sebastiaan Janssen
    0

    No, it doesn't matter, the DataTypeModels are optional, it's just looking for them in case there is one.

    To make your code a bit easier, try using this:

    @Model.GetPropertyValue("metaDescription", true)

    The "true" here tells GetPropertyValue to look up recursively and should do exactly what you're trying to do (and should be quite a bit more efficient).

  • Barry Fogarty 493 posts 1129 karma points
    Sep 19, 2011 @ 13:47
    Barry Fogarty
    0

    Thanks for your help Sebastiaan.  Unfortunately your code does not work for me.  It returns the value OK when the property has a value on the current node.  But if it does not have a value, it does not recurse up the tree to find the nearest ancestor with a value.

    To clarify, my document type DOES contain a property with Alias metaDescription (it is a property on a master document type). 

    What I need to do is check if that property has a value.  If it does, use it, but if it doesnt, traverse up the tree to find the nearest ancestor with value.

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Sep 19, 2011 @ 19:46
    Sebastiaan Janssen
    0

    Hmmm, yes, I seem to be experiencing the same problem. I'll check it out and get back to you!

  • Gareth Evans 138 posts 329 karma points c-trib
    Oct 04, 2011 @ 23:40
    Gareth Evans
    0

    There was a bug fix in 4.7.1.1 (unreleased) that should correct this

    Please try this build: http://dl.dropbox.com/u/2923715/LatestRazorMacroEngine-Only.zip

  • Eran Meir 401 posts 543 karma points
    Dec 17, 2011 @ 23:04
    Eran Meir
    0

    i have this problem too, i tried gareth solution, it doesn't work
    anyone got a solution?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Dec 17, 2011 @ 23:26
    Sebastiaan Janssen
    0

    @Eran Have you tried replacing the macro engine dll with the one Gareth posted?

  • Eran Meir 401 posts 543 karma points
    Dec 18, 2011 @ 13:35
    Eran Meir
    0

    i tried it already and it didn't help, any thought what can i check ?

  • Eran Meir 401 posts 543 karma points
    Dec 18, 2011 @ 15:38
    Eran Meir
    0

    anyone can please explain the meaning of the messages ?

  • Sebastiaan Janssen 4899 posts 14655 karma points MVP admin hq
    Dec 18, 2011 @ 16:31
    Sebastiaan Janssen
    0

    Sorry, I wasn't reading properly. The error (more of a warning, actually) means that it is looking for a RazorDataTypeModel for your datatype. To read more about RazorDataTypeModels scroll to the end of this blog post: http://umbraco.com/follow-us/blog-archive/2011/9/18/umbraco-razor-feature-walkthrough%E2%80%93part-7.aspx

    Anyway, to be able to help, I would need some more info, have you tried GetPropertyValue for example (that should just give a string back and not cause any problems)? What are you trying to do anyway, and what is the REAL problem (as said, this is just a warning message, not an actual error).

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies