Class ViewModelPropertyFilterExtensions
- Namespace
- Dynamicweb.Rendering
- Assembly
- Dynamicweb.Core.dll
Extension methods for attaching a ViewModelPropertyFilter to a ViewModelBase. The filter is deliberately not exposed as a property on the view models themselves, so it never shows up in serialized output, reflection over view model properties, or template IntelliSense.
public static class ViewModelPropertyFilterExtensions
- Inheritance
-
ViewModelPropertyFilterExtensions
- Inherited Members
Methods
GetPropertyFilter(ViewModelBase)
Gets the filter that limits which properties are written when the view model is serialized to JSON.
public static ViewModelPropertyFilter? GetPropertyFilter(this ViewModelBase viewModel)
Parameters
viewModelViewModelBaseThe view model.
Returns
- ViewModelPropertyFilter
The filter, or null if all properties are serialized.
SetPropertyFilter(ViewModelBase, ViewModelPropertyFilter?)
Sets the filter that limits which properties are written when the view model is serialized to JSON. The filter is propagated to nested view models during serialization, so it only needs to be set on the root.
public static void SetPropertyFilter(this ViewModelBase viewModel, ViewModelPropertyFilter? filter)
Parameters
viewModelViewModelBaseThe view model to filter.
filterViewModelPropertyFilterThe filter to apply, or null to serialize all properties.