Base type for creating your own viewmodel. More...
Public Member Functions | |
ViewModel (ApplicationContext applicationContext) | |
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... | |
bool | CanCreateObject () |
Gets a value indicating whether the current user is authorized to create an instance of the business domain type More... | |
bool | CanGetObject () |
Gets a value indicating whether the current user is authorized to retrieve an instance of the business domain type More... | |
bool | CanEditObject () |
Gets a value indicating whether the current user is authorized to edit/save an instance of the business domain type More... | |
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 | |
ApplicationContext | ApplicationContext [get] |
Gets the current ApplicationContext instance. More... | |
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 21 of file Csla.Blazor/ViewModel.cs.
Csla.Blazor.ViewModel< T >.ViewModel | ( | ApplicationContext | applicationContext | ) |
Creates an instance of the type.
applicationContext |
Definition at line 32 of file Csla.Blazor/ViewModel.cs.
bool Csla.Blazor.ViewModel< T >.CanCreateObject | ( | ) |
Gets a value indicating whether the current user is authorized to create an instance of the business domain type
Definition at line 292 of file Csla.Blazor/ViewModel.cs.
bool Csla.Blazor.ViewModel< T >.CanDeleteObject | ( | ) |
Gets a value indicating whether the current user is authorized to delete an instance of the business domain type
Definition at line 325 of file Csla.Blazor/ViewModel.cs.
bool Csla.Blazor.ViewModel< T >.CanEditObject | ( | ) |
Gets a value indicating whether the current user is authorized to edit/save an instance of the business domain type
Definition at line 314 of file Csla.Blazor/ViewModel.cs.
bool Csla.Blazor.ViewModel< T >.CanGetObject | ( | ) |
Gets a value indicating whether the current user is authorized to retrieve an instance of the business domain type
Definition at line 303 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Override to provide custom Model save behavior
Definition at line 148 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 223 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 237 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 188 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 206 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelChanged event
Definition at line 73 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelChanging event
oldValue | Old Model value |
newValue | New Model value |
Definition at line 60 of file Csla.Blazor/ViewModel.cs.
|
protectedvirtual |
Raises the ModelPropertyChanged event
propertyName |
Definition at line 82 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 91 of file Csla.Blazor/ViewModel.cs.
async Task Csla.Blazor.ViewModel< T >.SaveAsync | ( | ) |
|
getprotected |
Gets the current ApplicationContext instance.
Definition at line 26 of file Csla.Blazor/ViewModel.cs.
|
get |
Gets the last exception caught by the viewmodel during refresh or save operations.
Definition at line 284 of file Csla.Blazor/ViewModel.cs.
|
getset |
Gets or sets the Model object.
Definition at line 165 of file Csla.Blazor/ViewModel.cs.
|
getprotected |
Gets the first validation error message from the Model
Definition at line 267 of file Csla.Blazor/ViewModel.cs.
|
getprotected set |
Gets any error text generated by refresh or save operations
Definition at line 261 of file Csla.Blazor/ViewModel.cs.
Action Csla.Blazor.ViewModel< T >.ModelChanged |
Event raised when Model has changed
Definition at line 48 of file Csla.Blazor/ViewModel.cs.
Action<T, T> Csla.Blazor.ViewModel< T >.ModelChanging |
Event raised when Model is changing
Definition at line 44 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 53 of file Csla.Blazor/ViewModel.cs.
Action Csla.Blazor.ViewModel< T >.Saved |
Event raised after Model has been saved
Definition at line 40 of file Csla.Blazor/ViewModel.cs.