Quantcast
Viewing all articles
Browse latest Browse all 9076

Type 'Alloy.Models.lmageFile' could not be mapped to a PropertyDefinitionType

I've been tampering with a fresh template of the Alloy installation page for some time now, and one thing, that has been bugging me for a while now, is the ImageFile mapping. The whole site gives an error that says the ImageFile couldn't be mapped to a PropertyDefinitionType as written above.

The problem occurs when I define an ImageFile property in a block or page like this

public class ImageBlock : BlockData
{
  [Display(GroupName = SystemTabNames.Content)]
  [CultureSpecific]
  public virtual ImageFile Image { get; set; }
}

This approach breaks the whole site by telling me that the ImageFile could not be mapped to a property. The Alloy template has an ImageFileController, which maps the ImageFile to an ImageViewModel

public override ActionResult Index(ImageFile currentContent)
{
   var model = new ImageViewModel
   {
     Url = _urlResolver.GetUrl(currentContent.ContentLink),
     Name = currentContent.Name,
     Copyright = currentContent.Copyright
   };

   return PartialView(model);
}

But this does not offer any comfort at all. Nowhere in the Alloy template is the ImageFile property being used, which does not make any sense.

What was the idea of this? What am I missing in order to use an ImageFile property in my block and page types?


Viewing all articles
Browse latest Browse all 9076

Trending Articles