-
Notifications
You must be signed in to change notification settings - Fork 0
Views vs. Partial Views
Taggloo uses Views to render content, utilising Partial Views for repeated content and encapsulating functionality.
Partial Views are indicated using the _ prefix, eg. _LargeTranslateForm
A conventional view, eg. Index will contain content to render itself and delegate to Partial Views for rendering of sub-content. In the case of the Index view, this includes several Partial Views, including _LargeTranslateForm.
A GET request will typically require a fresh View Model to be prepared, which will include data for contained Partial Views. This data is prepared by a View Model Factory, specifically an implementation of IViewModelFactory<TViewModel>. This provides two methods, one for Creation, the other for Configuration (see the next paragraph for more details).
A PUT or POST request uses an implementation of IPartialViewModelFactory<TViewModel> to configure a View Model that can be passed into a Partial View. In the example of the Index view, this View Model implements the ILargeTranslateViewModel interface, which is configured by the LargeTranslateFormViewModelFactory View Model Factory. This is encapsulated within the IndexViewModelFactory and its implementation of the Create and Configure methods.