CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.BusinessBase< T > Class Template Referenceabstract

This is the base class from which most business objects will be derived. More...

Inheritance diagram for Csla.BusinessBase< T >:
Csla.Core.BusinessBase Csla.Core.ISavable Csla.Core.ISavable< T > Csla.Serialization.Mobile.ISerializationNotification Csla.Core.INotifyChildChanged Csla.Core.ICheckRules Csla.Rules.IHostRules Csla.Core.IParent Csla.Security.IAuthorizeReadWrite Csla.Core.IEditableBusinessObject Csla.Core.UndoableBase

Public Member Functions

override string ToString ()
 Returns a text representation of this object by returning the GetIdValue value in text form.
Clone ()
 Creates a clone of the object.
Save ()
 Saves the object to the database.
Task< T > SaveAsync ()
 Saves the object to the database.
Task< T > SaveAsync (bool forceUpdate)
 Saves the object to the database.
Save (bool forceUpdate)
 Saves the object to the database, forcing IsNew to false and IsDirty to True.
Task SaveAndMergeAsync ()
 Saves the object to the database, merging any resulting updates into the existing object graph.
async Task SaveAndMergeAsync (bool forceUpdate)
 Saves the object to the database, merging any resulting updates into the existing object graph.
Public Member Functions inherited from Csla.Core.BusinessBase
virtual bool CanReadProperty (IPropertyInfo property)
 Returns true if the user is allowed to read the calling property.
bool CanReadProperty (IPropertyInfo property, bool throwOnFalse)
 Returns true if the user is allowed to read the calling property.
bool CanReadProperty (string propertyName)
 Returns true if the user is allowed to read the specified property.
virtual bool CanWriteProperty (IPropertyInfo property)
 Returns true if the user is allowed to write the specified property.
bool CanWriteProperty (IPropertyInfo property, bool throwOnFalse)
 Returns true if the user is allowed to write the calling property.
bool CanWriteProperty (string propertyName)
 Returns true if the user is allowed to write the specified property.
virtual bool CanExecuteMethod (IMemberInfo method)
 Returns true if the user is allowed to execute the specified method.
bool CanExecuteMethod (IMemberInfo method, bool throwOnFalse)
 Returns true if the user is allowed to execute the specified method.
virtual bool CanExecuteMethod (string methodName)
 Returns true if the user is allowed to execute the specified method.
void BeginEdit ()
 Starts a nested edit on the object.
void CancelEdit ()
 Cancels the current edit process, restoring the object's state to its previous values.
void ApplyEdit ()
 Commits the current edit process.
virtual void Delete ()
 Marks the object for deletion. The object will be deleted as part of the next save operation.
async Task WaitForIdle ()
 Await this method to ensure business object is not busy.
Task WaitForIdle (TimeSpan timeout)
 Await this method to ensure business object is not busy.
virtual Task WaitForIdle (CancellationToken ct)
 Await this method to ensure the business object is not busy.
virtual bool IsPropertyBusy (IPropertyInfo property)
 Gets a value indicating whether a specific property is busy (has a currently executing async rule).
bool IsPropertyBusy (string propertyName)
 Gets a value indicating whether a specific property is busy (has a currently executing async rule).
BrokenRulesCollection GetBrokenRules ()
 Gets the broken rules for this object.
Public Member Functions inherited from Csla.Security.IAuthorizeReadWrite
bool CanWriteProperty (Core.IPropertyInfo property)
 Returns true if the user is allowed to write the to the specified property.
bool CanReadProperty (Core.IPropertyInfo property)
 Returns true if the user is allowed to read the specified property.
bool CanExecuteMethod (Core.IMemberInfo method)
 Returns true if the user is allowed to execute the specified method.
Public Member Functions inherited from Csla.Rules.IHostRules
void RuleStart (Core.IPropertyInfo property)
 Indicates that a rule has started processing.
void RuleComplete (Core.IPropertyInfo property)
 Indicates that a rule has finished processing.

Protected Member Functions

virtual ? object GetIdValue ()
 Override this method to return a unique identifying value for this object.
virtual async Task< T > SaveAsync (bool forceUpdate, object? userState, bool isSync)
 Saves the object to the database.
virtual void OnSaved (T newObject, Exception? e, object? userState)
 Raises the Saved event, indicating that the object has been saved, and providing a reference to the new object instance.
Protected Member Functions inherited from Csla.Core.BusinessBase
 BusinessBase ()
 Creates an instance of the type.
override void OnApplicationContextSet ()
 Method invoked after ApplicationContext is available.
virtual void Initialize ()
 Override this method to set up event handlers so user code in a partial class can respond to events raised by generated code.
virtual void SetParent (IParent? parent)
 Used by BusinessListBase as a child object is created to tell the child object about its parent.
virtual void MarkNew ()
 Marks the object as being a new object. This also marks the object as being dirty and ensures that it is not marked for deletion.
virtual void MarkOld ()
 Marks the object as being an old (not new) object. This also marks the object as being unchanged (not dirty).
void MarkDeleted ()
 Marks an object for deletion. This also marks the object as being dirty.
override void OnGetMetastate (System.IO.BinaryWriter writer)
override void OnSetMetastate (System.IO.BinaryReader reader)
void MarkDirty ()
 Marks an object as being dirty, or changed.
void MarkDirty (bool suppressEvent)
 Marks an object as being dirty, or changed.
virtual void PropertyHasChanged (IPropertyInfo property)
 Performs processing required when a property has changed.
virtual void MetaPropertyHasChanged (string name)
 Raises OnPropertyChanged for meta properties (IsXYZ) when PropertyChangedMode is not Windows.
virtual void CheckPropertyRules (IPropertyInfo property)
 Check rules for the property and notifies UI of properties that may have changed.
virtual void CheckObjectRules ()
 Check object rules and notifies UI of properties that may have changed.
void MarkClean ()
 Forces the object's IsDirty flag to false.
override void UndoChangesComplete ()
 Called when an undo operation has completed.
override void AcceptChangesComplete ()
 Notifies the parent object (if any) that this child object's edits have been accepted.
void MarkAsChild ()
 Marks the object as being a child object.
virtual object GetClone ()
 Creates a clone of the object.
virtual void OnValidationComplete ()
 Raises the ValidationComplete event.
BusinessRuleManager GetRegisteredRules ()
 Gets the registered rules. Only for unit testing and not visible to code.
virtual void AddBusinessRules ()
 Override this method in your business class to be notified when you need to set up shared business rules.
virtual void DataPortal_OnDataPortalInvoke (DataPortalEventArgs e)
 Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
virtual void DataPortal_OnDataPortalInvokeComplete (DataPortalEventArgs e)
 Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
virtual void DataPortal_OnDataPortalException (DataPortalEventArgs e, Exception ex)
 Called by the server-side DataPortal if an exception occurs during data access.
virtual void Child_Create ()
 Override this method to load a new business object with default values from the database.
virtual void Child_OnDataPortalInvoke (DataPortalEventArgs e)
 Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
virtual void Child_OnDataPortalInvokeComplete (DataPortalEventArgs e)
 Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
virtual void Child_OnDataPortalException (DataPortalEventArgs e, Exception ex)
 Called by the server-side DataPortal if an exception occurs during data access.
virtual string GetDataErrorInfoError ()
 Returns a string describing the error state of the object for use by IDataErrorInfo.Error. This method is called by the IDataErrorInfo.Error property implementation.
virtual IEnumerable GetNotifyDataErrorInfoGetErrors (string? propertyName)
 Gets the validation errors for a specified property or for the entire entity for use by INotifyDataErrorInfo.GetErrors(string?). This method is called by the INotifyDataErrorInfo.GetErrors(string?) method implementation.
virtual bool GetNotifyDataErrorInfoHasErrors ()
 Gets a value that indicates whether the entity has validation errors for use by INotifyDataErrorInfo.HasErrors. This method is called by the INotifyDataErrorInfo.HasErrors property implementation.
virtual string GetDataErrorInfoIndexerError (string columnName)
 Gets the error message for the property with the given name for use by IDataErrorInfo.this[string]. This method is called by the IDataErrorInfo.this[string] indexer implementation.
virtual void OnErrorsChanged (string? propertyName)
 Call to indicate that errors have changed for a property.
override void OnPropertyChanged (IPropertyInfo propertyInfo)
 Call this method to raise the PropertyChanged event for a specific property.
virtual void Deserialized ()
 Invoked after the object has been deserialized to allow derived classes to perform custom post-deserialization processing.
void AddEventHooks (IBusinessObject child)
 For internal use.
virtual void OnAddEventHooks (IBusinessObject child)
 Hook child object events.
void RemoveEventHooks (IBusinessObject child)
 For internal use only.
virtual void OnRemoveEventHooks (IBusinessObject child)
 Unhook child object events.
P? GetProperty< P > (string propertyName, P field, P? defaultValue)
 Gets a property's value, first checking authorization.
P? GetProperty< P > (string propertyName, P field, P? defaultValue, NoAccessBehavior noAccess)
 Gets a property's value, first checking authorization.
P? GetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P field)
 Gets a property's value, first checking authorization.
P? GetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P field, P? defaultValue, NoAccessBehavior noAccess)
 Gets a property's value, first checking authorization.
P? GetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< F > propertyInfo, F field)
 Gets a property's value as a specified type, first checking authorization.
P? GetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< F > propertyInfo, F field, NoAccessBehavior noAccess)
 Gets a property's value as a specified type, first checking authorization.
P? GetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo)
 Gets a property's managed field value, first checking authorization.
P? GetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< F > propertyInfo)
 Gets a property's value from the list of managed field values, first checking authorization, and converting the value to an appropriate type.
P? GetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< F > propertyInfo, NoAccessBehavior noAccess)
 Gets a property's value from the list of managed field values, first checking authorization, and converting the value to an appropriate type.
P? GetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, NoAccessBehavior noAccess)
 Gets a property's value as a specified type, first checking authorization.
object? GetProperty (IPropertyInfo propertyInfo)
 Gets a property's value as a specified type.
P? GetProperty< P > (IPropertyInfo propertyInfo)
 Gets a property's managed field value, first checking authorization.
P? LazyGetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > property, Func< P > valueGenerator)
 Lazily initializes a property and returns the resulting value.
bool PropertyIsLoading (IPropertyInfo propertyInfo)
 Gets a value indicating whether a lazy loaded property is currently being retrieved.
P? LazyGetPropertyAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > property, Task< P > factory)
 Lazily initializes a property and returns the resulting value.
P? ReadPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< F > propertyInfo)
 Gets a property's value from the list of managed field values, converting the value to an appropriate type.
P? ReadProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo)
 Gets a property's value as a specified type.
virtual ? object ReadProperty (IPropertyInfo propertyInfo)
 Gets a property's value.
P? LazyReadProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > property, Func< P > valueGenerator)
 Gets a property's value as a specified type.
P? LazyReadPropertyAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > property, Task< P > factory)
 Gets a property's value as a specified type.
void SetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, ref P? field, P? newValue)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, ref P? field, P? newValue)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] V > (PropertyInfo< P > propertyInfo, ref P? field, V? newValue)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] V > (PropertyInfo< P > propertyInfo, ref P? field, V? newValue, NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, ref P? field, P? newValue, NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] V > (string propertyName, ref P? field, V? newValue, NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P? newValue)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F > (PropertyInfo< P > propertyInfo, F? newValue)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F > (PropertyInfo< P > propertyInfo, F? newValue, NoAccessBehavior noAccess)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P? newValue, NoAccessBehavior noAccess)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change.
void SetProperty (IPropertyInfo propertyInfo, object? newValue)
 Sets a property's managed field with the supplied value, and then calls PropertyHasChanged if the value does change.
void SetProperty< P > (IPropertyInfo propertyInfo, P? newValue)
 Sets a property's managed field with the supplied value, and then calls PropertyHasChanged if the value does change.
void LoadPropertyConvert<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] F > (PropertyInfo< P > propertyInfo, F? newValue)
 Loads a property's managed field with the supplied value.
void LoadProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P? newValue)
 Loads a property's managed field with the supplied value.
bool LoadPropertyMarkDirty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > propertyInfo, P? newValue)
 Loads a property's managed field with the supplied value and mark field as dirty if value is modified.
virtual bool LoadPropertyMarkDirty (IPropertyInfo propertyInfo, object? newValue)
 Loads a property's managed field with the supplied value.
virtual void LoadProperty (IPropertyInfo propertyInfo, object? newValue)
 Loads a property's managed field with the supplied value.
void LoadPropertyAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] R > (PropertyInfo< R > property, Task< R > factory)
 Load a property from an async method.
void MarkBusy ()
 Mark the object as busy (it is running an async operation).
void MarkIdle ()
 Mark the object as not busy (it is not running an async operation).
virtual void OnBusyChanged (BusyChangedEventArgs args)
 Raise the BusyChanged event.
virtual void OnUnhandledAsyncException (ErrorEventArgs error)
 Raises the UnhandledAsyncException event.
void OnUnhandledAsyncException (object originalSender, Exception error)
 Raises the UnhandledAsyncException event.
virtual void OnChildChanged (ChildChangedEventArgs e)
 Raises the ChildChanged event, indicating that a child object has been changed.
virtual void EditChildComplete (IEditableBusinessObject child)
 Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed.
override void OnGetState (SerializationInfo info, StateMode mode)
 Override this method to insert your field values into the MobileFormatter serialization stream.
override void OnSetState (SerializationInfo info, StateMode mode)
 Override this method to retrieve your field values from the MobileFormatter serialization stream.
override void OnGetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to insert your child object references into the MobileFormatter serialization stream.
override void OnSetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to retrieve your child object references from the MobileFormatter serialization stream.
Protected Member Functions inherited from Csla.Core.UndoableBase
 UndoableBase ()
 Creates an instance of the type.
virtual void CopyingState ()
 This method is invoked before the CopyState operation begins.
virtual void CopyStateComplete ()
 This method is invoked after the CopyState operation is complete.
virtual void UndoingChanges ()
 This method is invoked after the UndoChanges operation is complete.
virtual void AcceptingChanges ()
 This method is invoked before the AcceptChanges operation begins.
override void OnGetState (SerializationInfo info, StateMode mode)
 Override this method to insert your field values into the MobileFormatter serialization stream.
override void OnSetState (SerializationInfo info, StateMode mode)
 Override this method to retrieve your field values from the MobileFormatter serialization stream.
override void OnGetMetastate (BinaryWriter writer)
 Override this method to write field values directly to a binary stream for metastate serialization.
Parameters
writerBinary writer for the output stream.

override void OnSetMetastate (BinaryReader reader)
 Override this method to read field values directly from a binary stream for metastate deserialization.
Parameters
readerBinary reader for the input stream.

Protected Member Functions inherited from Csla.Core.BindableBase
 BindableBase ()
 Creates an instance of the type.
virtual bool ShouldHandlerSerialize (PropertyChangedEventHandler value)
 Override this method to change the default logic for determining if the event handler should be serialized.
virtual void OnPropertyChanged (string propertyName)
 Call this method to raise the PropertyChanged event for a specific property.
virtual void OnMetaPropertyChanged (string propertyName)
virtual void OnIsDirtyChanged ()
 Call this method to raise the PropertyChanged event for all object properties.
virtual void OnUnknownPropertyChanged ()
 Call this method to raise the PropertyChanged event for all object properties.
virtual void OnIsDirtyChanging ()
 Call this method to raise the PropertyChanging event for all object properties.
virtual void OnUnknownPropertyChanging ()
 Call this method to raise the PropertyChanging event for all object properties.
virtual void OnPropertyChanging (string propertyName)
 Call this method to raise the PropertyChanging event for a specific property.
virtual void OnPropertyChanging (IPropertyInfo propertyInfo)
 Call this method to raise the PropertyChanging event for a specific property.
virtual bool ShouldHandlerSerialize (PropertyChangingEventHandler value)
 Override this method to change the default logic for determining if the event handler should be serialized.

Static Protected Member Functions

static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (PropertyInfo< P > info)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (Expression< Func< T, object > > propertyLambdaExpression)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, RelationshipTypes relationship)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (Expression< Func< T, object > > propertyLambdaExpression, RelationshipTypes relationship)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, string? friendlyName)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (Expression< Func< T, object > > propertyLambdaExpression, string? friendlyName)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, string? friendlyName, P? defaultValue)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (Expression< Func< T, object > > propertyLambdaExpression, string? friendlyName, P? defaultValue)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (string propertyName, string? friendlyName, P? defaultValue, RelationshipTypes relationship)
 Indicates that the specified property belongs to the business object type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > (Expression< Func< T, object > > propertyLambdaExpression, string? friendlyName, P? defaultValue, RelationshipTypes relationship)
 Indicates that the specified property belongs to the business object type.
static MethodInfo RegisterMethod (string methodName)
 Registers a method for use in Authorization.
static MethodInfo RegisterMethod (Expression< Action< T > > methodLambdaExpression)
 Registers a method for use in Authorization.
Static Protected Member Functions inherited from Csla.Core.BusinessBase
static IMemberInfo RegisterMethod (Type objectType, IMemberInfo info)
 Indicates that the specified method belongs to the type.
static MethodInfo RegisterMethod (Type objectType, string methodName)
 Indicates that the specified method belongs to the type.
static PropertyInfo< P > RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, PropertyInfo< P > info)
 Indicates that the specified property belongs to the type.

Events

EventHandler< SavedEventArgs >? Saved [add, remove]
 Event raised when an object has been saved.
Events inherited from Csla.Core.BusinessBase
EventHandler? ValidationComplete [add, remove]
 Event raised when validation is complete.
BusyChangedEventHandlerBusyChanged [add, remove]
 Event indicating that the IsBusy property has changed.
EventHandler< ErrorEventArgs >? UnhandledAsyncException [add, remove]
 Event indicating that an exception occurred during the processing of an async operation.
EventHandler< ChildChangedEventArgs >? ChildChanged [add, remove]
 Event raised when a child object has been changed.
Events inherited from Csla.Core.BindableBase
PropertyChangedEventHandler? PropertyChanged [add, remove]
 Implements a serialization-safe PropertyChanged event.
PropertyChangingEventHandler? PropertyChanging [add, remove]
 Implements a serialization-safe PropertyChanging event.
Events inherited from Csla.Core.INotifyBusy
BusyChangedEventHandlerBusyChanged
 Event raised when the object's busy status changes.
Events inherited from Csla.Core.INotifyUnhandledAsyncException
EventHandler< ErrorEventArgs >? UnhandledAsyncException
 Event indicating that an exception occurred during an asynchronous operation.
Events inherited from Csla.Core.INotifyChildChanged
EventHandler< ChildChangedEventArgs >? ChildChanged
 Event indictating that a child object has changed.
Events inherited from Csla.Core.ISavable
EventHandler< SavedEventArgs >? Saved
 Event raised when an object has been saved.
Events inherited from Csla.Core.ISavable< T >
EventHandler< SavedEventArgs >? Saved
 Event raised when an object has been saved.

Additional Inherited Members

Properties inherited from Csla.Core.BusinessBase
IParentParent [get]
 Provide access to the parent reference for use in child object code.
bool IsNew = true [get]
 Returns true if this is a new object, false if it is a pre-existing object.
bool IsDeleted [get]
 Returns true if this object is marked for deletion.
virtual bool IsDirty [get]
 Returns true if this object's data, or any of its fields or child objects data, has been changed.
virtual bool IsSelfDirty [get]
 Returns true if this object's data has been changed.
virtual bool IsSavable [get]
 Returns true if this object is both dirty and valid.
bool DisableIEditableObject [get, set]
 Gets or sets a value indicating whether the IEditableObject interface methods should be disabled for this object.
bool IsChild [get]
 Returns true if this is a child (non-root) object.
BusinessRules BusinessRules [get]
 Provides access to the broken rules functionality.
virtual bool IsValid [get]
 Returns true if the object and its child objects are currently valid, false if the object or any of its child objects have broken rules or are otherwise invalid.
virtual bool IsSelfValid [get]
 Returns true if the object is currently valid, false if the object has broken rules or is otherwise invalid.
virtual BrokenRulesCollection BrokenRulesCollection [get]
 Provides access to the readonly collection of broken business rules for this object.
virtual bool IsBusy [get]
 Gets a value indicating if this object or its child objects are busy.
virtual bool IsSelfBusy [get]
 Gets a value indicating if this object is busy.
FieldDataManager FieldManager [get]
 Gets the PropertyManager object for this business object.
Properties inherited from Csla.Core.UndoableBase
ApplicationContext ApplicationContext [get, set]
 Gets or sets a reference to the current ApplicationContext.
bool BindingEdit [get, set]
 Gets or sets a value indicating whether n-level undo was invoked through IEditableObject. FOR INTERNAL CSLA .NET USE ONLY!
int EditLevel [get]
 Returns the current edit level of the object.

Detailed Description

This is the base class from which most business objects will be derived.

This class is the core of the CSLA .NET framework. To create a business object, inherit from this class.

Please refer to 'Expert C# 2008 Business Objects' for full details on the use of this base class to create business objects.

Template Parameters
TType of the business object being defined.
Type Constraints
T :BusinessBase<T> 

Member Function Documentation

◆ Clone()

T Csla.BusinessBase< T >.Clone ( )
inline

Creates a clone of the object.

Returns
A new object containing the exact data of the original object.

◆ GetIdValue()

virtual ? object Csla.BusinessBase< T >.GetIdValue ( )
inlineprotectedvirtual

Override this method to return a unique identifying value for this object.

◆ OnSaved()

virtual void Csla.BusinessBase< T >.OnSaved ( T newObject,
Exception? e,
object? userState )
inlineprotectedvirtual

Raises the Saved event, indicating that the object has been saved, and providing a reference to the new object instance.

Parameters
newObjectThe new object instance.
eException that occurred during operation.
userStateUser state object.
Exceptions
ArgumentNullExceptionnewObject is null.

◆ RegisterMethod() [1/2]

MethodInfo Csla.BusinessBase< T >.RegisterMethod ( Expression< Action< T > > methodLambdaExpression)
inlinestaticprotected

Registers a method for use in Authorization.

Parameters
methodLambdaExpressionThe method lambda expression.
Exceptions
ArgumentNullExceptionmethodLambdaExpression is null.

◆ RegisterMethod() [2/2]

MethodInfo Csla.BusinessBase< T >.RegisterMethod ( string methodName)
inlinestaticprotected

Registers a method for use in Authorization.

Parameters
methodNameMethod name from nameof()
Exceptions
ArgumentNullExceptionmethodName is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [1/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( Expression< Func< T, object > > propertyLambdaExpression)
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
Exceptions
ArgumentNullExceptionpropertyLambdaExpression is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [2/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( Expression< Func< T, object > > propertyLambdaExpression,
RelationshipTypes relationship )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
relationshipRelationship with property value.
Exceptions
ArgumentNullExceptionpropertyLambdaExpression is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [3/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( Expression< Func< T, object > > propertyLambdaExpression,
string? friendlyName )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
friendlyNameFriendly description for a property to be used in databinding
Exceptions
ArgumentNullExceptionpropertyLambdaExpression is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [4/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( Expression< Func< T, object > > propertyLambdaExpression,
string? friendlyName,
P? defaultValue )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
friendlyNameFriendly description for a property to be used in databinding
defaultValueDefault Value for the property
Exceptions
ArgumentNullExceptionpropertyLambdaExpression is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [5/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( Expression< Func< T, object > > propertyLambdaExpression,
string? friendlyName,
P? defaultValue,
RelationshipTypes relationship )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
friendlyNameFriendly description for a property to be used in databinding
defaultValueDefault Value for the property
relationshipRelationship with property value.
Exceptions
ArgumentNullExceptionpropertyLambdaExpression is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [6/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( PropertyInfo< P > info)
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property.
Parameters
infoPropertyInfo object for the property.
Returns
The provided IPropertyInfo object.
Exceptions
ArgumentNullExceptioninfo is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [7/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( string propertyName)
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
Exceptions
ArgumentNullExceptionpropertyName is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [8/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( string propertyName,
RelationshipTypes relationship )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
relationshipRelationship with property value.
Exceptions
ArgumentNullExceptionpropertyName is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [9/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( string propertyName,
string? friendlyName )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
friendlyNameFriendly description for a property to be used in databinding
Exceptions
ArgumentNullExceptionpropertyName is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [10/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( string propertyName,
string? friendlyName,
P? defaultValue )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
friendlyNameFriendly description for a property to be used in databinding
defaultValueDefault Value for the property
Exceptions
ArgumentNullExceptionpropertyName is null.

◆ RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P >() [11/11]

PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] P > ( string propertyName,
string? friendlyName,
P? defaultValue,
RelationshipTypes relationship )
inlinestaticprotected

Indicates that the specified property belongs to the business object type.

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
friendlyNameFriendly description for a property to be used in databinding
defaultValueDefault Value for the property
relationshipRelationship with property value.
Exceptions
ArgumentNullExceptionpropertyName is null.

◆ Save() [1/2]

T Csla.BusinessBase< T >.Save ( )
inline

Saves the object to the database.

Calling this method starts the save operation, causing the object to be inserted, updated or deleted within the database based on the object's current state.

If Core.BusinessBase.IsDeleted is true the object will be deleted. Otherwise, if Core.BusinessBase.IsNew is true the object will be inserted. Otherwise the object's data will be updated in the database.

All this is contingent on Core.BusinessBase.IsDirty. If this value is false, no data operation occurs. It is also contingent on Core.BusinessBase.IsValid. If this value is false an exception will be thrown to indicate that the UI attempted to save an invalid object.

It is important to note that this method returns a new version of the business object that contains any data updated during the save operation. You MUST update all object references to use this new version of the business object in order to have access to the correct object data.

You can override this method to add your own custom behaviors to the save operation. For instance, you may add some security checks to make sure the user can save the object. If all security checks pass, you would then invoke the base Save method via base.Save().

Returns
A new object containing the saved values.

Implements Csla.Core.ISavable.

◆ Save() [2/2]

T Csla.BusinessBase< T >.Save ( bool forceUpdate)
inline

Saves the object to the database, forcing IsNew to false and IsDirty to True.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling Save().
Returns
A new object containing the saved values.

This overload is designed for use in web applications when implementing the Update method in your data wrapper object.

Implements Csla.Core.ISavable.

◆ SaveAndMergeAsync() [1/2]

Task Csla.BusinessBase< T >.SaveAndMergeAsync ( )
inline

Saves the object to the database, merging any resulting updates into the existing object graph.

Implements Csla.Core.ISavable.

◆ SaveAndMergeAsync() [2/2]

async Task Csla.BusinessBase< T >.SaveAndMergeAsync ( bool forceUpdate)
inline

Saves the object to the database, merging any resulting updates into the existing object graph.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling SaveAndMergeAsync().

Implements Csla.Core.ISavable.

◆ SaveAsync() [1/3]

Task< T > Csla.BusinessBase< T >.SaveAsync ( )
inline

Saves the object to the database.

Implements Csla.Core.ISavable.

◆ SaveAsync() [2/3]

Task< T > Csla.BusinessBase< T >.SaveAsync ( bool forceUpdate)
inline

Saves the object to the database.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling Save().

Implements Csla.Core.ISavable.

◆ SaveAsync() [3/3]

virtual async Task< T > Csla.BusinessBase< T >.SaveAsync ( bool forceUpdate,
object? userState,
bool isSync )
inlineprotectedvirtual

Saves the object to the database.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling Save().
userStateUser state data.
isSyncTrue if the save operation should be synchronous.

◆ ToString()

override string Csla.BusinessBase< T >.ToString ( )
inline

Returns a text representation of this object by returning the GetIdValue value in text form.

Event Documentation

◆ Saved

EventHandler<SavedEventArgs>? Csla.BusinessBase< T >.Saved
addremove

Event raised when an object has been saved.


The documentation for this class was generated from the following file: