Base type for creating your own viewmodel. More...
Public Member Functions | |
ViewModel (IDataPortal< T > dataPortal) | |
Creates an instance of the type More... | |
async Task< T > | RefreshAsync (Func< Task< T > > factory) |
Refresh the Model More... | |
async Task | SaveAsync () |
Saves the Model More... | |
IPropertyInfo | GetPropertyInfo< P > (Expression< Func< P > > property) |
Get a PropertyInfo object for a property. More... | |
IPropertyInfo | GetPropertyInfo< P > (Expression< Func< P > > property, string id) |
Get a PropertyInfo object for a property. More... | |
IPropertyInfo | GetPropertyInfo (string propertyName) |
Get a PropertyInfo object for a property of the Model. More... | |
IPropertyInfo | GetPropertyInfo (string propertyName, string id) |
Get a PropertyInfo object for a property of the Model. More... | |
Static Public Member Functions | |
static bool | CanCreateObject () |
Gets a value indicating whether the current user is authorized to create an instance of the business domain type More... | |
static bool | CanGetObject () |
Gets a value indicating whether the current user is authorized to retrieve an instance of the business domain type More... | |
static bool | CanEditObject () |
Gets a value indicating whether the current user is authorized to edit/save an instance of the business domain type More... | |
static bool | CanDeleteObject () |
Gets a value indicating whether the current user is authorized to delete an instance of the business domain type More... | |
Protected Member Functions | |
virtual void | OnModelChanging (T oldValue, T newValue) |
Raises the ModelChanging event More... | |
virtual void | OnModelChanged () |
Raises the ModelChanged event More... | |
virtual void | OnModelPropertyChanged (string propertyName) |
Raises the ModelPropertyChanged event More... | |
virtual async Task< T > | DoSaveAsync () |
Override to provide custom Model save behavior More... | |
Properties | |
T | Model [getset] |
Gets or sets the Model object. More... | |
string | ViewModelErrorText [getprotected set] |
Gets any error text generated by refresh or save operations More... | |
virtual string | ModelErrorText [get] |
Gets the first validation error message from the Model More... | |
Exception | Exception [get] |
Gets the last exception caught by the viewmodel during refresh or save operations. More... | |
Events | |
Action | Saved |
Event raised after Model has been saved More... | |
Action< T, T > | ModelChanging |
Event raised when Model is changing More... | |
Action | ModelChanged |
Event raised when Model has changed More... | |
PropertyChangedEventHandler | ModelPropertyChanged |
Event raised when the Model object raises its PropertyChanged event More... | |
Base type for creating your own viewmodel.
Definition at line 22 of file Csla.Blazor/ViewModel.cs.
Csla.Blazor.ViewModel< T >.ViewModel | ( | IDataPortal< T > | dataPortal | ) |
Creates an instance of the type
Definition at line 79 of file Csla.Blazor/ViewModel.cs.
|
static |
Gets a value indicating whether the current user is authorized to create an instance of the business domain type
Definition at line 283 of file Csla.Blazor/ViewModel.cs.
|
static |
Gets a value indicating whether the current user is authorized to delete an instance of the business domain type
Definition at line 316 of file Csla.Blazor/ViewModel.cs.
|
static |
Gets a value indicating whether the current user is authorized to edit/save an instance of the business domain type
Definition at line 305 of file Csla.Blazor/ViewModel.cs.
|
static |
Gets a value indicating whether the current user is authorized to retrieve an instance of the business domain type
Definition at line 294 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Override to provide custom Model save behavior
Definition at line 140 of file Csla.Blazor/ViewModel.cs.
IPropertyInfo Csla.Blazor.ViewModel< T >.GetPropertyInfo | ( | string | propertyName | ) |
Get a PropertyInfo object for a property of the Model.
PropertyInfo provides access to the metastate of the property.
propertyName | Property name |
Definition at line 214 of file Csla.Blazor/ViewModel.cs.
IPropertyInfo Csla.Blazor.ViewModel< T >.GetPropertyInfo | ( | string | propertyName, |
string | id | ||
) |
Get a PropertyInfo object for a property of the Model.
PropertyInfo provides access to the metastate of the property.
propertyName | Property name |
id | Unique identifier for property in list or array |
Definition at line 228 of file Csla.Blazor/ViewModel.cs.
IPropertyInfo Csla.Blazor.ViewModel< T >.GetPropertyInfo< P > | ( | Expression< Func< P > > | property | ) |
Get a PropertyInfo object for a property.
PropertyInfo provides access to the metastate of the property.
property | Property expression |
Definition at line 179 of file Csla.Blazor/ViewModel.cs.
IPropertyInfo Csla.Blazor.ViewModel< T >.GetPropertyInfo< P > | ( | Expression< Func< P > > | property, |
string | id | ||
) |
Get a PropertyInfo object for a property.
PropertyInfo provides access to the metastate of the property.
property | Property expression |
id | Unique identifier for property in list or array |
Definition at line 197 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelChanged event
Definition at line 62 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelChanging event
oldValue | Old Model value |
newValue | New Model value |
Definition at line 49 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelPropertyChanged event
propertyName |
Definition at line 71 of file Csla.Blazor/ViewModel.cs.
async Task< T > Csla.Blazor.ViewModel< T >.RefreshAsync | ( | Func< Task< T > > | factory | ) |
Refresh the Model
factory | Async data portal or factory method |
Definition at line 88 of file Csla.Blazor/ViewModel.cs.
async Task Csla.Blazor.ViewModel< T >.SaveAsync | ( | ) |
|
get |
Gets the last exception caught by the viewmodel during refresh or save operations.
Definition at line 275 of file Csla.Blazor/ViewModel.cs.
|
getset |
Gets or sets the Model object.
Definition at line 157 of file Csla.Blazor/ViewModel.cs.
|
getprotected |
Gets the first validation error message from the Model
Definition at line 258 of file Csla.Blazor/ViewModel.cs.
|
getprotected set |
Gets any error text generated by refresh or save operations
Definition at line 252 of file Csla.Blazor/ViewModel.cs.
Action Csla.Blazor.ViewModel< T >.ModelChanged |
Event raised when Model has changed
Definition at line 37 of file Csla.Blazor/ViewModel.cs.
Action<T, T> Csla.Blazor.ViewModel< T >.ModelChanging |
Event raised when Model is changing
Definition at line 33 of file Csla.Blazor/ViewModel.cs.
PropertyChangedEventHandler Csla.Blazor.ViewModel< T >.ModelPropertyChanged |
Event raised when the Model object raises its PropertyChanged event
Definition at line 42 of file Csla.Blazor/ViewModel.cs.
Action Csla.Blazor.ViewModel< T >.Saved |
Event raised after Model has been saved
Definition at line 29 of file Csla.Blazor/ViewModel.cs.