umco / umbraco-ditto

Ditto - the friendly view-model mapper for Umbraco
http://our.umbraco.org/projects/developer-tools/ditto
MIT License
79 stars 33 forks source link

DittoView - Adds support for ModelsBuilder #239

Closed leekelleher closed 5 years ago

leekelleher commented 6 years ago

Extends the DittoView directive to declare the strongly-typed model for the IPublishedContent (generated by ModelsBuilder).

The usage would be...

@inherits DittoView<ContentPage, MyViewModel>
@Model.Content // strongly-typed as ContentPage
@Model.View // strong-typed as MyViewModel

I've tried to keep the API backwards-compatible, but it did require changes to BaseDittoViewModel, so it's a breaking-change, (although someone would have to be doing some advanced stuff if they are using BaseDittoViewModel).