Table of Contents

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

item ItemViewModel

The ItemViewModel to check.

parameterName string

The name of the parameter that is being checked. This is automatically provided by the compiler.

Examples

@Model.Item.Require();

Exceptions

ArgumentNullException

Thrown when the item is 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

item ItemViewModel

The ItemViewModel to check.

parameterName string

The 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 item is null.

To top