CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
Csla.BusinessBase< T > Class Template Reference

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< T > Csla.Core.ISavable< T > Csla.IBusinessBase Csla.Serialization.Mobile.ISerializationNotification Csla.Core.INotifyChildChanged Csla.Core.INotifyBusy Csla.Core.ICheckRules Csla.Rules.IHostRules Csla.Core.IParent Csla.Security.IAuthorizeReadWrite Csla.Core.ISavable< T > Csla.Core.IEditableBusinessObject Csla.Serialization.Mobile.IMobileObject Csla.Core.IBusinessObject Csla.Serialization.Mobile.ISerializationNotification Csla.Core.INotifyChildChanged Csla.Core.INotifyBusy Csla.Core.ICheckRules Csla.Rules.IHostRules Csla.Core.IParent Csla.Security.IAuthorizeReadWrite Csla.Core.IEditableBusinessObject Csla.Core.UndoableBase Csla.Validation.BusinessBase< T >

Public Member Functions

override string ToString ()
 Returns a text representation of this object by returning the GetIdValue value in text form. More...
 
Clone ()
 Creates a clone of the object. More...
 
Save ()
 Saves the object to the database. More...
 
async Task< T > SaveAsync ()
 Saves the object to the database. More...
 
async Task< T > SaveAsync (bool forceUpdate)
 Saves the object to the database. More...
 
Save (bool forceUpdate)
 Saves the object to the database, forcing IsNew to false and IsDirty to True. More...
 
async Task SaveAndMergeAsync ()
 Saves the object to the database, merging any resulting updates into the existing object graph. More...
 
async Task SaveAndMergeAsync (bool forceUpdate)
 Saves the object to the database, merging any resulting updates into the existing object graph. More...
 
void BeginSave ()
 Starts an async operation to save the object to the database. More...
 
void BeginSave (object userState)
 Starts an async operation to save the object to the database. More...
 
void BeginSave (EventHandler< SavedEventArgs > handler)
 Starts an async operation to save the object to the database. More...
 
async void BeginSave (bool forceUpdate, EventHandler< SavedEventArgs > handler, object userState)
 Starts an async operation to save the object to the database. More...
 
void BeginSave (bool forceUpdate)
 Starts an async operation to save the object to the database. More...
 
void BeginSave (bool forceUpdate, EventHandler< SavedEventArgs > handler)
 Starts an async operation to save the object to the database. More...
 
void BeginSave (EventHandler< SavedEventArgs > handler, object userState)
 Saves the object to the database, forcing IsNew to false and IsDirty to True. More...
 
- Public Member Functions inherited from Csla.Core.BusinessBase
virtual bool CanReadProperty (Csla.Core.IPropertyInfo property)
 Returns true if the user is allowed to read the calling property. More...
 
bool CanReadProperty (Csla.Core.IPropertyInfo property, bool throwOnFalse)
 Returns true if the user is allowed to read the calling property. More...
 
bool CanReadProperty (string propertyName)
 Returns true if the user is allowed to read the specified property. More...
 
virtual bool CanWriteProperty (Csla.Core.IPropertyInfo property)
 Returns true if the user is allowed to write the specified property. More...
 
bool CanWriteProperty (Csla.Core.IPropertyInfo property, bool throwOnFalse)
 Returns true if the user is allowed to write the calling property. More...
 
bool CanWriteProperty (string propertyName)
 Returns true if the user is allowed to write the specified property. More...
 
virtual bool CanExecuteMethod (Csla.Core.IMemberInfo method)
 Returns true if the user is allowed to execute the specified method. More...
 
bool CanExecuteMethod (Csla.Core.IMemberInfo method, bool throwOnFalse)
 Returns true if the user is allowed to execute the specified method. More...
 
virtual bool CanExecuteMethod (string methodName)
 Returns true if the user is allowed to execute the specified method. More...
 
void BeginEdit ()
 Starts a nested edit on the object. More...
 
void CancelEdit ()
 Cancels the current edit process, restoring the object's state to its previous values. More...
 
void ApplyEdit ()
 Commits the current edit process. More...
 
virtual void Delete ()
 Marks the object for deletion. More...
 
virtual bool IsPropertyBusy (Csla.Core.IPropertyInfo property)
 Gets a value indicating whether a specific property is busy (has a currently executing async rule). More...
 
bool IsPropertyBusy (string propertyName)
 Gets a value indicating whether a specific property is busy (has a currently executing async rule). More...
 
BrokenRulesCollection GetBrokenRules ()
 Gets the broken rules for this object More...
 
- Public Member Functions inherited from Csla.Security.IAuthorizeReadWrite
bool CanWriteProperty (Csla.Core.IPropertyInfo property)
 Returns true if the user is allowed to write the to the specified property. More...
 
bool CanReadProperty (Csla.Core.IPropertyInfo property)
 Returns true if the user is allowed to read the specified property. More...
 
bool CanExecuteMethod (Csla.Core.IMemberInfo method)
 Returns true if the user is allowed to execute the specified method. More...
 
- Public Member Functions inherited from Csla.Core.IParent
void RemoveChild (Core.IEditableBusinessObject child)
 This method is called by a child object when it wants to be removed from the collection. More...
 

Protected Member Functions

virtual object GetIdValue ()
 Override this method to return a unique identifying value for this object. More...
 
virtual async Task< T > SaveAsync (bool forceUpdate, object userState, bool isSync)
 Saves the object to the database. More...
 
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. More...
 
- Protected Member Functions inherited from Csla.Core.BusinessBase
 BusinessBase ()
 Creates an instance of the object. More...
 
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. More...
 
virtual void SetParent (Core.IParent parent)
 Used by BusinessListBase as a child object is created to tell the child object about its parent. More...
 
virtual void MarkNew ()
 Marks the object as being a new object. More...
 
virtual void MarkOld ()
 Marks the object as being an old (not new) object. More...
 
void MarkDeleted ()
 Marks an object for deletion. More...
 
void MarkDirty ()
 Marks an object as being dirty, or changed. More...
 
void MarkDirty (bool suppressEvent)
 Marks an object as being dirty, or changed. More...
 
virtual void PropertyHasChanged (Csla.Core.IPropertyInfo property)
 Performs processing required when a property has changed. More...
 
virtual void MetaPropertyHasChanged (string name)
 Raises OnPropertyChanged for meta properties (IsXYZ) when PropertyChangedMode is not Windows More...
 
virtual void CheckPropertyRules (IPropertyInfo property)
 Check rules for the property and notifies UI of properties that may have changed. More...
 
virtual void CheckObjectRules ()
 Check object rules and notifies UI of properties that may have changed. More...
 
void MarkClean ()
 Forces the object's IsDirty flag to false. More...
 
override void UndoChangesComplete ()
 Called when an undo operation has completed. More...
 
override void AcceptChangesComplete ()
 Notifies the parent object (if any) that this child object's edits have been accepted. More...
 
void MarkAsChild ()
 Marks the object as being a child object. More...
 
virtual object GetClone ()
 Creates a clone of the object. More...
 
virtual void OnValidationComplete ()
 Raises the ValidationComplete event More...
 
BusinessRuleManager GetRegisteredRules ()
 Gets the registered rules. More...
 
virtual void AddBusinessRules ()
 Override this method in your business class to be notified when you need to set up shared business rules. More...
 
virtual void DataPortal_OnDataPortalInvoke (DataPortalEventArgs e)
 Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method. More...
 
virtual void DataPortal_OnDataPortalInvokeComplete (DataPortalEventArgs e)
 Called by the server-side DataPortal after calling the requested DataPortal_XYZ method. More...
 
virtual void DataPortal_OnDataPortalException (DataPortalEventArgs e, Exception ex)
 Called by the server-side DataPortal if an exception occurs during data access. More...
 
virtual void Child_Create ()
 Override this method to load a new business object with default values from the database. More...
 
virtual void Child_OnDataPortalInvoke (DataPortalEventArgs e)
 Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method. More...
 
virtual void Child_OnDataPortalInvokeComplete (DataPortalEventArgs e)
 Called by the server-side DataPortal after calling the requested DataPortal_XYZ method. More...
 
virtual void Child_OnDataPortalException (DataPortalEventArgs e, Exception ex)
 Called by the server-side DataPortal if an exception occurs during data access. More...
 
virtual void OnDeserialized (System.Runtime.Serialization.StreamingContext context)
 This method is called on a newly deserialized object after deserialization is complete. More...
 
void AddEventHooks (IBusinessObject child)
 For internal use. More...
 
virtual void OnAddEventHooks (IBusinessObject child)
 Hook child object events. More...
 
void RemoveEventHooks (IBusinessObject child)
 For internal use only. More...
 
virtual void OnRemoveEventHooks (IBusinessObject child)
 Unhook child object events. More...
 
GetProperty< P > (string propertyName, P field, P defaultValue)
 Gets a property's value, first checking authorization. More...
 
GetProperty< P > (string propertyName, P field, P defaultValue, Security.NoAccessBehavior noAccess)
 Gets a property's value, first checking authorization. More...
 
GetProperty< P > (PropertyInfo< P > propertyInfo, P field)
 Gets a property's value, first checking authorization. More...
 
GetProperty< P > (PropertyInfo< P > propertyInfo, P field, P defaultValue, Security.NoAccessBehavior noAccess)
 Gets a property's value, first checking authorization. More...
 
GetPropertyConvert< F, P > (PropertyInfo< F > propertyInfo, F field)
 Gets a property's value as a specified type, first checking authorization. More...
 
GetPropertyConvert< F, P > (PropertyInfo< F > propertyInfo, F field, Security.NoAccessBehavior noAccess)
 Gets a property's value as a specified type, first checking authorization. More...
 
GetProperty< P > (PropertyInfo< P > propertyInfo)
 Gets a property's managed field value, first checking authorization. More...
 
GetPropertyConvert< F, 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. More...
 
GetPropertyConvert< F, P > (PropertyInfo< F > propertyInfo, Security.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. More...
 
GetProperty< P > (PropertyInfo< P > propertyInfo, Security.NoAccessBehavior noAccess)
 Gets a property's value as a specified type, first checking authorization. More...
 
object GetProperty (IPropertyInfo propertyInfo)
 Gets a property's value as a specified type. More...
 
GetProperty< P > (IPropertyInfo propertyInfo)
 Gets a property's managed field value, first checking authorization. More...
 
LazyGetProperty< P > (PropertyInfo< P > property, Func< P > valueGenerator)
 Lazily initializes a property and returns the resulting value. More...
 
LazyGetPropertyAsync< P > (PropertyInfo< P > property, Task< P > factory)
 Lazily initializes a property and returns the resulting value. More...
 
ReadPropertyConvert< F, P > (PropertyInfo< F > propertyInfo)
 Gets a property's value from the list of managed field values, converting the value to an appropriate type. More...
 
ReadProperty< P > (PropertyInfo< P > propertyInfo)
 Gets a property's value as a specified type. More...
 
virtual object ReadProperty (IPropertyInfo propertyInfo)
 Gets a property's value. More...
 
LazyReadProperty< P > (PropertyInfo< P > property, Func< P > valueGenerator)
 Gets a property's value as a specified type. More...
 
LazyReadPropertyAsync< P > (PropertyInfo< P > property, Task< P > factory)
 Gets a property's value as a specified type. More...
 
void SetProperty< 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. More...
 
void SetProperty< 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. More...
 
void SetPropertyConvert< P, 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. More...
 
void SetPropertyConvert< P, V > (PropertyInfo< P > propertyInfo, ref P field, V newValue, Security.NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change. More...
 
void SetProperty< P > (string propertyName, ref P field, P newValue, Security.NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change. More...
 
void SetPropertyConvert< P, V > (string propertyName, ref P field, V newValue, Security.NoAccessBehavior noAccess)
 Sets a property's backing field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change. More...
 
void SetProperty< 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. More...
 
void SetPropertyConvert< P, 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. More...
 
void SetPropertyConvert< P, F > (PropertyInfo< P > propertyInfo, F newValue, Security.NoAccessBehavior noAccess)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change. More...
 
void SetProperty< P > (PropertyInfo< P > propertyInfo, P newValue, Security.NoAccessBehavior noAccess)
 Sets a property's managed field with the supplied value, first checking authorization, and then calling PropertyHasChanged if the value does change. More...
 
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. More...
 
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. More...
 
void LoadPropertyConvert< P, F > (PropertyInfo< P > propertyInfo, F newValue)
 Loads a property's managed field with the supplied value. More...
 
void LoadProperty< P > (PropertyInfo< P > propertyInfo, P newValue)
 Loads a property's managed field with the supplied value. More...
 
bool LoadPropertyMarkDirty< 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. More...
 
virtual bool LoadPropertyMarkDirty (IPropertyInfo propertyInfo, object newValue)
 Loads a property's managed field with the supplied value. More...
 
virtual void LoadProperty (IPropertyInfo propertyInfo, object newValue)
 Loads a property's managed field with the supplied value. More...
 
void LoadPropertyAsync< R > (PropertyInfo< R > property, Task< R > factory)
 Load a property from an async method. More...
 
void MarkBusy ()
 Mark the object as busy (it is running an async operation). More...
 
void MarkIdle ()
 Mark the object as not busy (it is not running an async operation). More...
 
virtual void OnBusyChanged (BusyChangedEventArgs args)
 Raise the BusyChanged event. More...
 
virtual void OnUnhandledAsyncException (ErrorEventArgs error)
 Raises the UnhandledAsyncException event. More...
 
void OnUnhandledAsyncException (object originalSender, Exception error)
 Raises the UnhandledAsyncException event. More...
 
virtual void OnChildChanged (ChildChangedEventArgs e)
 Raises the ChildChanged event, indicating that a child object has been changed. More...
 
virtual void EditChildComplete (Core.IEditableBusinessObject child)
 Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed. More...
 
override void OnGetState (Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
 Override this method to insert your field values into the MobileFormatter serialzation stream. More...
 
override void OnSetState (Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
 Override this method to retrieve your field values from the MobileFormatter serialzation stream. More...
 
override void OnGetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
 Override this method to insert your child object references into the MobileFormatter serialzation stream. More...
 
override void OnSetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)
 Override this method to retrieve your child object references from the MobileFormatter serialzation stream. More...
 
- Protected Member Functions inherited from Csla.Core.UndoableBase
 UndoableBase ()
 Creates an instance of the object. More...
 
virtual void CopyingState ()
 This method is invoked before the CopyState operation begins. More...
 
virtual void CopyStateComplete ()
 This method is invoked after the CopyState operation is complete. More...
 
virtual void UndoingChanges ()
 This method is invoked after the UndoChanges operation is complete. More...
 
virtual void AcceptingChanges ()
 This method is invoked before the AcceptChanges operation begins. More...
 
override void OnGetState (SerializationInfo info, StateMode mode)
 Override this method to insert your field values into the MobileFormatter serialzation stream. More...
 
override void OnSetState (SerializationInfo info, StateMode mode)
 Override this method to retrieve your field values from the MobileFormatter serialzation stream. More...
 
- Protected Member Functions inherited from Csla.Core.BindableBase
 BindableBase ()
 Creates an instance of the object. More...
 
virtual bool ShouldHandlerSerialize (PropertyChangedEventHandler value)
 Override this method to change the default logic for determining if the event handler should be serialized More...
 
virtual void OnPropertyChanged (string propertyName)
 Call this method to raise the PropertyChanged event for a specific property. More...
 
virtual void OnMetaPropertyChanged (string propertyName)
 
virtual void OnPropertyChanged (IPropertyInfo propertyInfo)
 Call this method to raise the PropertyChanged event for a specific property. More...
 
virtual void OnIsDirtyChanged ()
 Call this method to raise the PropertyChanged event for all object properties. More...
 
virtual void OnUnknownPropertyChanged ()
 Call this method to raise the PropertyChanged event for all object properties. More...
 
virtual void OnIsDirtyChanging ()
 Call this method to raise the PropertyChanging event for all object properties. More...
 
virtual void OnUnknownPropertyChanging ()
 Call this method to raise the PropertyChanging event for all object properties. More...
 
virtual void OnPropertyChanging (string propertyName)
 Call this method to raise the PropertyChanging event for a specific property. More...
 
virtual void OnPropertyChanging (IPropertyInfo propertyInfo)
 Call this method to raise the PropertyChanging event for a specific property. More...
 
virtual bool ShouldHandlerSerialize (PropertyChangingEventHandler value)
 Override this method to change the default logic for determining if the event handler should be serialized More...
 
- Protected Member Functions inherited from Csla.Core.MobileObject
virtual void OnGetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to insert your child object references into the MobileFormatter serialzation stream. More...
 
virtual void OnSetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to retrieve your child object references from the MobileFormatter serialzation stream. More...
 

Static Protected Member Functions

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

Properties

EventHandler< Csla.Core.SavedEventArgsSaved
 Event raised when an object has been saved. More...
 
- Properties inherited from Csla.Core.BusinessBase
Core.IParent Parent [get]
 Provide access to the parent reference for use in child object code. More...
 
bool IsNew [get]
 Returns true if this is a new object, false if it is a pre-existing object. More...
 
bool IsDeleted [get]
 Returns true if this object is marked for deletion. More...
 
virtual bool IsDirty [get]
 Returns true if this object's data, or any of its fields or child objects data, has been changed. More...
 
virtual bool IsSelfDirty [get]
 Returns true if this object's data has been changed. More...
 
virtual bool IsSavable [get]
 Returns true if this object is both dirty and valid. More...
 
bool DisableIEditableObject [getset]
 Gets or sets a value indicating whether the IEditableObject interface methods should be disabled for this object. More...
 
bool IsChild [get]
 Returns true if this is a child (non-root) object. More...
 
EventHandler ValidationComplete
 Event raised when validation is complete. More...
 
BusinessRules BusinessRules [get]
 Provides access to the broken rules functionality. More...
 
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. More...
 
virtual bool IsSelfValid [get]
 Returns true if the object is currently valid, false if the object has broken rules or is otherwise invalid. More...
 
virtual Rules.BrokenRulesCollection BrokenRulesCollection [get]
 Provides access to the readonly collection of broken business rules for this object. More...
 
virtual bool IsBusy [get]
 Gets a value indicating if this object or its child objects are busy. More...
 
virtual bool IsSelfBusy [get]
 Gets a value indicating if this object is busy. More...
 
BusyChangedEventHandler BusyChanged
 Event indicating that the IsBusy property has changed. More...
 
EventHandler< ErrorEventArgsUnhandledAsyncException
 Event indicating that an exception occurred during the processing of an async operation. More...
 
EventHandler< Csla.Core.ChildChangedEventArgsChildChanged
 Event raised when a child object has been changed. More...
 
FieldDataManager FieldManager [get]
 Gets the PropertyManager object for this business object. More...
 
- Properties inherited from Csla.Core.UndoableBase
bool BindingEdit [getset]
 Gets or sets a value indicating whether n-level undo was invoked through IEditableObject. More...
 
int EditLevel [get]
 Returns the current edit level of the object. More...
 
- Properties inherited from Csla.Core.BindableBase
PropertyChangedEventHandler PropertyChanged
 Implements a serialization-safe PropertyChanged event. More...
 
PropertyChangingEventHandler PropertyChanging
 Implements a serialization-safe PropertyChanging event. More...
 
- Properties inherited from Csla.Core.IUndoableObject
int EditLevel [get]
 Gets the current edit level of the object. More...
 
- Properties inherited from Csla.Core.IEditableBusinessObject
int EditLevelAdded [getset]
 For internal use only!! More...
 
- Properties inherited from Csla.Core.IBusinessObject
int Identity [get]
 Gets a value representing this object instance's unique identity value within the business object graph. More...
 
- Properties inherited from Csla.Core.ITrackStatus
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. More...
 
bool IsSelfValid [get]
 Returns true if the object is currently valid, false if the object has broken rules or is otherwise invalid. More...
 
bool IsDirty [get]
 Returns true if this object's data, or any of its fields or child objects data, has been changed. More...
 
bool IsSelfDirty [get]
 Returns true if this object's data has been changed. More...
 
bool IsDeleted [get]
 Returns true if this object is marked for deletion. More...
 
bool IsNew [get]
 Returns true if this is a new object, false if it is a pre-existing object. More...
 
bool IsSavable [get]
 Returns true if this object is both dirty and valid. More...
 
bool IsChild [get]
 Returns true if this is a child object, false if it is a root object. More...
 
- Properties inherited from Csla.Core.INotifyBusy
bool IsBusy [get]
 Gets a value indicating whether the object, or any of the object's child objects, are busy running an asynchronous operation. More...
 
bool IsSelfBusy [get]
 Gets a value indicating whether the object is busy running an asynchronous operation. More...
 
- Properties inherited from Csla.Core.IParent
IParent Parent [get]
 Provide access to the parent reference for use in child object code. More...
 

Additional Inherited Members

- Events inherited from Csla.Core.INotifyBusy
BusyChangedEventHandler BusyChanged
 Event raised when the object's busy status changes. More...
 
- Events inherited from Csla.Core.INotifyUnhandledAsyncException
EventHandler< ErrorEventArgsUnhandledAsyncException
 Event indicating that an exception occurred during an asynchronous operation. More...
 
- Events inherited from Csla.Core.INotifyChildChanged
EventHandler< ChildChangedEventArgsChildChanged
 Event indictating that a child object has changed. More...
 
- Events inherited from Csla.Core.ISavable< T >
EventHandler< SavedEventArgsSaved
 Event raised when an object has been saved. More...
 

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> 

Definition at line 36 of file Csla/BusinessBase.cs.

Member Function Documentation

◆ BeginSave() [1/7]

void Csla.BusinessBase< T >.BeginSave ( )

Starts an async operation to save the object to the database.

Implements Csla.Core.ISavable< T >.

Definition at line 272 of file Csla/BusinessBase.cs.

◆ BeginSave() [2/7]

void Csla.BusinessBase< T >.BeginSave ( bool  forceUpdate)

Starts an async operation to save the object to the database.

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

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

Definition at line 349 of file Csla/BusinessBase.cs.

◆ BeginSave() [3/7]

void Csla.BusinessBase< T >.BeginSave ( bool  forceUpdate,
EventHandler< SavedEventArgs handler 
)

Starts an async operation to save the object to the database.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling Save().
handlerDelegate reference to a callback handler that will be invoked when the async operation is complete.

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

Definition at line 371 of file Csla/BusinessBase.cs.

◆ BeginSave() [4/7]

async void Csla.BusinessBase< T >.BeginSave ( bool  forceUpdate,
EventHandler< SavedEventArgs handler,
object  userState 
)

Starts an async operation to save the object to the database.

Parameters
forceUpdateIf true, triggers overriding IsNew and IsDirty. If false then it is the same as calling Save().
handlerMethod called when the operation is complete.
userStateUser state data.

Definition at line 311 of file Csla/BusinessBase.cs.

◆ BeginSave() [5/7]

void Csla.BusinessBase< T >.BeginSave ( EventHandler< SavedEventArgs handler)

Starts an async operation to save the object to the database.

Parameters
handlerMethod called when the operation is complete.

Definition at line 294 of file Csla/BusinessBase.cs.

◆ BeginSave() [6/7]

void Csla.BusinessBase< T >.BeginSave ( EventHandler< SavedEventArgs handler,
object  userState 
)

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

Parameters
handlerDelegate reference to a callback handler that will be invoked when the async operation is complete.
userStateUser state data.

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

Definition at line 391 of file Csla/BusinessBase.cs.

◆ BeginSave() [7/7]

void Csla.BusinessBase< T >.BeginSave ( object  userState)

Starts an async operation to save the object to the database.

Parameters
userStateUser state data.

Implements Csla.Core.ISavable< T >.

Definition at line 282 of file Csla/BusinessBase.cs.

◆ Clone()

T Csla.BusinessBase< T >.Clone ( )

Creates a clone of the object.

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

Definition at line 79 of file Csla/BusinessBase.cs.

◆ GetIdValue()

virtual object Csla.BusinessBase< T >.GetIdValue ( )
protectedvirtual

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

Definition at line 46 of file Csla/BusinessBase.cs.

◆ OnSaved()

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

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.

Definition at line 476 of file Csla/BusinessBase.cs.

◆ RegisterMethod() [1/2]

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

Registers a method for use in Authorization.

Parameters
methodLambdaExpressionThe method lambda expression.
Returns

Definition at line 694 of file Csla/BusinessBase.cs.

◆ RegisterMethod() [2/2]

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

Registers a method for use in Authorization.

Parameters
methodNameMethod name from nameof()
Returns

Definition at line 684 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [1/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression)
staticprotected

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

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
Returns

Definition at line 526 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [2/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
defaultValue 
)
staticprotected

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

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
defaultValueDefault Value for the property
Returns

Definition at line 541 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [3/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
RelationshipTypes  relationship 
)
staticprotected

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

Template Parameters
PType of property
Parameters
propertyLambdaExpressionProperty Expression
relationshipRelationship with property value.
Returns

Definition at line 569 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [4/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
string  friendlyName 
)
staticprotected

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
Returns

Definition at line 596 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [5/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
string  friendlyName,
defaultValue 
)
staticprotected

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
Returns

Definition at line 642 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [6/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
string  friendlyName,
defaultValue,
RelationshipTypes  relationship 
)
staticprotected

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.
Returns

Definition at line 673 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [7/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( Expression< Func< T, object > >  propertyLambdaExpression,
string  friendlyName,
RelationshipTypes  relationship 
)
staticprotected

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
relationshipRelationship with property value.
Returns

Definition at line 612 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [8/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( PropertyInfo< P >  info)
staticprotected

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.

Definition at line 502 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [9/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( string  propertyName)
staticprotected

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

Template Parameters
PType of property
Parameters
propertyNameProperty name from nameof()
Returns

Definition at line 514 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [10/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( string  propertyName,
RelationshipTypes  relationship 
)
staticprotected

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.
Returns

Definition at line 556 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [11/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( string  propertyName,
string  friendlyName 
)
staticprotected

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
Returns

Definition at line 583 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [12/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( string  propertyName,
string  friendlyName,
defaultValue 
)
staticprotected

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
Returns

Definition at line 628 of file Csla/BusinessBase.cs.

◆ RegisterProperty< P >() [13/13]

static PropertyInfo< P > Csla.BusinessBase< T >.RegisterProperty< P > ( string  propertyName,
string  friendlyName,
defaultValue,
RelationshipTypes  relationship 
)
staticprotected

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.
Returns

Definition at line 658 of file Csla/BusinessBase.cs.

◆ Save() [1/2]

T Csla.BusinessBase< T >.Save ( )

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< T >.

Definition at line 121 of file Csla/BusinessBase.cs.

◆ Save() [2/2]

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

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< T >.

Definition at line 231 of file Csla/BusinessBase.cs.

◆ SaveAndMergeAsync() [1/2]

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

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

Implements Csla.Core.ISavable< T >.

Definition at line 249 of file Csla/BusinessBase.cs.

◆ SaveAndMergeAsync() [2/2]

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

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< T >.

Definition at line 263 of file Csla/BusinessBase.cs.

◆ SaveAsync() [1/3]

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

Saves the object to the database.

Implements Csla.Core.ISavable< T >.

Definition at line 139 of file Csla/BusinessBase.cs.

◆ SaveAsync() [2/3]

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

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< T >.

Definition at line 151 of file Csla/BusinessBase.cs.

◆ SaveAsync() [3/3]

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

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.

Definition at line 165 of file Csla/BusinessBase.cs.

◆ ToString()

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

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

Definition at line 60 of file Csla/BusinessBase.cs.

Property Documentation

◆ Saved

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

Event raised when an object has been saved.

Definition at line 431 of file Csla/BusinessBase.cs.