Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Nov 03, 2015 @ 11:55
    Ismail Mayat
    0

    Related link property

    Total newbie with ditto, so I have doc type which has property Related Links its the standard Umbraco Related Link property editor. So in my poco what do i need todo to strongly map,

    public [???] PrimaryHeaderLinks {get;set;}

    Will this work out of the box or do i need to install Jeavons property converters?

    Regards

    Ismail

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 03, 2015 @ 11:59
    Lee Kelleher
    101

    Hi Ismail,

    If you're using Jeavon's Property Value Converters library, then all you need to have is this...

    public RelatedLinks PrimaryHeaderLinks { get; set; }
    

    Then Ditto will be able to map it.

    Cheers,
    - Lee

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Nov 03, 2015 @ 12:01
    Ismail Mayat
    0

    Woot, ta.

    One more thing what about archtype properties i guess i would have write my own converterts?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 03, 2015 @ 12:03
    Lee Kelleher
    0

    Yeah, it's either...

    1. Write your own TypeConverters, (which is pretty easy once you've done one).
    2. Take a look at Mick Law's library for it: https://github.com/micklaw/Ditto.Resolvers
    3. Wait a couple of weeks for me to finish my "Archetype to IPublishedContent" code ;-)

    Cheers,
    - Lee

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 03, 2015 @ 12:05
    Lee Kelleher
    0

    Found a quick example of a custom TypeConverter that uses Archetype...

    https://gist.github.com/leekelleher/513c48c634fc44729900#file-4-metadatatypeconverter-cs

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Nov 03, 2015 @ 12:15
    Ismail Mayat
    0

    Cheers lee,

    One more thing I have got a service which is in business logic assembly i have some code like:

     var globalContent = siteLanguage.Children.FirstOrDefault(x => x.DocumentTypeAlias == "GlobalContent");
            return globalContent.As<GlobalContent>();
    

    The first statement returns IPublishedContent when i try second to do the mapping i get cannot resolve As error, am i missing reference or can you not do this?

    Regards

    Ismail

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 03, 2015 @ 12:22
    Lee Kelleher
    2

    You should definitely be able to do that.

    Check that you have a namespace reference for...

    using Our.Umbraco.Ditto;
    

    Cheers,
    - Lee

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Nov 03, 2015 @ 12:30
    Ismail Mayat
    0

    Lee,

    Done it was me being a learner driver lol

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 03, 2015 @ 12:31
    Lee Kelleher
    0

    No worries! Good luck with the Ditto mappings :-)

Please Sign in or register to post replies

Write your reply to:

Draft