Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
To me, I get a quite good YSOD with detailed Exception message at site startup if I forget to make a property virtual. Don't you get that?
Don't remember if it only applies when I have the Display attributes though (which to me is essential to add)
I haven't tested it lately, it was a few years back now, but I know I forgot it earlier and just got null back. I saw an other user had the same problem the other day so it seems to still be a small problem sometimes...maybe tweak it a little then I guess :)
+1
It is possible to define the following block:
[ContentType(GUID = "1F8B71EF-4776-4282-A8F0-45A6599FF06F")] public class MyBlock : BlockData { [UIHint(UIHint.Image)] public ContentReference Image { get; set; } }
Episerver won't throw any exception (ysod), and it will allow editors to store the value in edit mode.
In backend, Image is always null.
There is a bug in the validation if a property is part of an interface (because it is virtual but also final): http://world.episerver.com/support/Bug-list/bug/CMS-3090
Tested the above code and it seems to throw now.
If you create a pagetype with new properties it would be neat if we could get a clear indication or warning if the property isn't set as virtual in code = won't work.
That would save some debugging time in most projects. Is it visible in logs maybe already? I haven't checked. Possible to display in edit /admin?