callumbwhyte / super-value-converters

A collection of powerful property value converters for cleaner code in Umbraco
MIT License
14 stars 12 forks source link

NestedContent items are not being converted to strongly typed models #7

Closed robertjf closed 5 years ago

robertjf commented 5 years ago

When I generate my models, any Nested Content (and probably other types like StackedContent) with single Document Types configured should map to the appropriate type. Instead they are mapping to IEnumerable. See below for details:

DataType configuration: image

Generated code:

        ///<summary>
        /// Slideshow
        ///</summary>
        [ImplementPropertyType("slides")]
        public IEnumerable<IPublishedContent> Slides
        {
            get { return this.GetPropertyValue<IEnumerable<IPublishedContent>>("slides"); }
        }

What I expect:

        ///<summary>
        /// Slideshow
        ///</summary>
        [ImplementPropertyType("slides")]
        public IEnumerable<IPublishedContent> Slides
        {
            get { return this.GetPropertyValue<ProjectSlideshow>("slides"); }
        }
robertjf commented 5 years ago

actually, it seems this is only the case when the nested content is in single item mode - other properties based on Nested Content don't seem to be affected.

callumbwhyte commented 5 years ago

Thanks for raising this @robertjf - I also noticed this one and put a fix in.

If you download v1.0.1 of SuperValueConverters (available from all good package stores: Our Umbraco, NuGet, Github) it will fix your issue!