Created
August 31, 2018 15:30
-
-
Save naepalm/9c5d93231a79e1f9bc6a7ff0e6b7992d to your computer and use it in GitHub Desktop.
Converts the core radio button automagically with ModelsBuilder from the value Id to the prevalue string. This does not use Dependency Injection, but it does work, so feel free to use it if you'd like!
@leekelleher Ah-hah, brilliant! Thanks for the link to the code, I hadn't actually looked 😅 So it isn't as if calling the helper is somehow saving a database hit anyway. Might as well just use the service then 😉
Saves on an extra allocation too.
(When you become obsessed with allocations, you see them everywhere)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@naepalm - Nice! 🎉
To save on creating the
UmbracoHelper
instance, you could callDataTypeService.GetPreValueAsString
directly.The
UmbracoHelper.GetPreValueAsString
method is a wrapper: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/UmbracoHelper.cs#L1573