Class ItemViewModelExtensions
- Namespace
- Dynamicweb.Frontend
- Assembly
- Dynamicweb.dll
Extension methods for ItemViewModel and for Page and Item to get ItemViewModel instances.
public static class ItemViewModelExtensions
- Inheritance
-
ItemViewModelExtensions
- Inherited Members
Methods
Require(ItemViewModel?, string?)
Ensures that the specified ItemViewModel is not null. Throws an exception if it is null.
public static void Require(this ItemViewModel? item, string? parameterName = null)
Parameters
itemItemViewModelThe ItemViewModel to check.
parameterNamestringThe name of the parameter that is being checked. This is automatically provided by the compiler.
Examples
@Model.Item.Require();
Exceptions
- ArgumentNullException
Thrown when the
itemis null.
RequireItem(ItemViewModel?, string?)
Ensures that the specified ItemViewModel is not null. Throws an exception if it is null.
public static ItemViewModel RequireItem(this ItemViewModel? item, string? parameterName = null)
Parameters
itemItemViewModelThe ItemViewModel to check.
parameterNamestringThe name of the parameter that is being checked. This is automatically provided by the compiler.
Returns
- ItemViewModel
The original ItemViewModel if it is not null.
Examples
@{var item = Model.Item.RequireItem();}
Exceptions
- ArgumentNullException
Thrown when the
itemis null.