![]() |
CSLA .NET 10.0.0
A home for your business logic
|
This is the base class from which most business collections or lists will be derived. More...
Public Member Functions | |
| T | Clone () |
| Creates a clone of the object. | |
| bool | ContainsDeleted (C item) |
| Returns true if the internal deleted list contains the specified child object. | |
| 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. | |
| async Task | WaitForIdle () |
| Await this method to ensure business object is not busy. | |
| T | Save () |
| Saves the object to the database. | |
| async Task< T > | SaveAsync () |
| Saves the object to the database. | |
| async Task | SaveAndMergeAsync () |
| Saves the object to the database, merging any resulting updates into the existing object graph. | |
| C[] | ToArray () |
| Get an array containing all items in the list. | |
| Public Member Functions inherited from Csla.Core.ExtendedBindingList< T > | |
| void | AddRange (IEnumerable< T > range) |
| Add a range of items to the list. | |
| 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. | |
| SuppressListChangedEventsClass (BindingList< TC > businessObject) | |
| void | Dispose () |
| Public Member Functions inherited from Csla.Core.MobileBindingList< T > | |
| LoadListModeObject (IMobileList target) | |
| Create instance of type. | |
| void | Dispose () |
| Disposes the object. | |
Protected Member Functions | |
| BusinessBindingListBase () | |
| Creates an instance of the type. | |
| 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 object | GetClone () |
| Creates a clone of the object. | |
| virtual void | EditChildComplete (IEditableBusinessObject child) |
| Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed. | |
| override object | AddNewCore () |
| Override this method to create a new object that is added to the collection. | |
| override void | InsertItem (int index, C item) |
| Sets the edit level of the child object as it is added. | |
| override void | RemoveItem (int index) |
| Marks the child object for deletion and moves it to the collection of deleted objects. | |
| override void | SetItem (int index, C item) |
| Replaces the item at the specified index with the specified item, first moving the original item to the deleted list. | |
| override void | ClearItems () |
| Clears the collection, moving all active items to the deleted list. | |
| override void | OnGetState (Serialization.Mobile.SerializationInfo info) |
| Override this method to insert your field values into the MobileFormatter serialization stream. | |
| override void | OnSetState (Serialization.Mobile.SerializationInfo info) |
| Override this method to retrieve your field values from the MobileFormatter serialization stream. | |
| override void | OnGetChildren (Serialization.Mobile.SerializationInfo info, Serialization.Mobile.MobileFormatter formatter) |
| Override this method to insert child objects into the MobileFormatter serialization stream. | |
| override void | OnSetChildren (Serialization.Mobile.SerializationInfo info, Serialization.Mobile.MobileFormatter formatter) |
| Override this method to get child objects from the MobileFormatter serialization stream. | |
| override void | Deserialized () |
| Invoked after the object has been deserialized to allow derived classes to perform custom post-deserialization processing.Override this method in a derived class to implement actions that should occur immediately after deserialization, such as initializing transient fields or validating object state. This method is called automatically during the deserialization process. | |
| void | MarkAsChild () |
| Marks the object as being a child object. | |
| virtual void | Child_Create () |
| Initializes a new instance of the object with default values. | |
| virtual void | Child_Update (params object?[] parameters) |
| Saves all items in the list, automatically performing insert, update or delete operations as necessary. | |
| virtual async Task | Child_UpdateAsync (params object?[] parameters) |
| Asynchronously saves all items in the list, automatically performing insert, update or delete operations as necessary. | |
| virtual async Task< T > | SaveAsync (object? userState, bool isSync) |
| Saves the object to the database. | |
| 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_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 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. | |
| virtual void | SetParent (IParent? parent) |
| Used by BusinessListBase as a child object is created to tell the child object about its parent. | |
| override void | Child_PropertyChanged (object? sender, PropertyChangedEventArgs e) |
| Handles any PropertyChanged event from a child object and echoes it up as a ListChanged event. | |
| Protected Member Functions inherited from Csla.Core.ExtendedBindingList< T > | |
| void | OnRemovingItem (T removedItem) |
| Raise the RemovingItem event. | |
| override void | RemoveItem (int index) |
| Remove the item at the specified index. | |
| virtual void | OnBusyChanged (BusyChangedEventArgs args) |
| Override this method to be notified when the IsBusy property has changed. | |
| void | OnBusyChanged (string propertyName, bool busy) |
| Raises the BusyChanged event for a specific property. | |
| virtual void | OnUnhandledAsyncException (ErrorEventArgs error) |
| Method invoked when an unhandled async exception has occurred. | |
| void | OnUnhandledAsyncException (object originalSender, Exception error) |
| Raises the UnhandledAsyncException event. | |
| override void | InsertItem (int index, T item) |
| Invoked when an item is inserted into the list. | |
| virtual void | OnAddEventHooks (T item) |
| Method invoked when events are hooked for a child object. | |
| virtual void | OnRemoveEventHooks (T item) |
| Method invoked when events are unhooked for a child object. | |
| virtual void | OnChildChanged (ChildChangedEventArgs e) |
| Raises the ChildChanged event, indicating that a child object has been changed. | |
| Protected Member Functions inherited from Csla.Core.MobileBindingList< T > | |
| virtual void | SetLoadListMode (bool enabled) |
| Sets the load list mode for the list. | |
| virtual void | OnGetState (SerializationInfo info) |
| Override this method to get custom field values from the serialization stream. | |
| virtual void | OnGetChildren (SerializationInfo info, MobileFormatter formatter) |
| Override this method to get custom child object values from the serialization stream. | |
| virtual void | OnSetState (SerializationInfo info) |
| Override this method to set custom field values into the serialization stream. | |
| virtual void | OnSetChildren (SerializationInfo info, MobileFormatter formatter) |
| Override this method to set custom child object values into the serialization stream. | |
| virtual void | OnGetMetastate (BinaryWriter writer) |
| Override this method to write field values directly to a binary stream for metastate serialization. | |
| virtual void | OnSetMetastate (BinaryReader reader) |
| Override this method to read field values directly from a binary stream for metastate deserialization. | |
Properties | |
| ApplicationContext | ApplicationContext [get] |
| Gets the current ApplicationContext. | |
| MobileList< C > | DeletedList [get] |
| A collection containing all child objects marked for deletion. | |
| int | EditLevel [get] |
| Returns the current edit level of the object. | |
| bool | IsChild [get] |
| Indicates whether this collection object is a child object. | |
| bool | IsDirty [get] |
| Gets a value indicating whether this object's data has been changed. | |
| virtual bool | IsSelfValid [get] |
| Gets a value indicating whether this object is currently in a valid state (has no broken validation rules). | |
| virtual bool | IsValid [get] |
| Gets a value indicating whether this object is currently in a valid state (has no broken validation rules). | |
| virtual bool | IsSavable [get] |
| Returns true if this object is both dirty and valid. | |
| override bool | IsBusy [get] |
| Gets the busy status for this object and its child objects. | |
| IParent? | Parent [get] |
| Provide access to the parent reference for use in child object code. | |
| Properties inherited from Csla.Core.ExtendedBindingList< T > | |
| virtual bool | IsBusy [get] |
| Gets the busy status for this object and its child objects. | |
| virtual bool | IsSelfBusy [get] |
| Gets the busy status for this object. | |
| IDisposable | SuppressListChangedEvents [get] |
| Use this object to suppress ListChangedEvents for an entire code block. May be nested in multiple levels for the same object. | |
| Properties inherited from Csla.Core.MobileBindingList< T > | |
| LoadListModeObject | LoadListMode [get] |
| By wrapping this property inside Using block you can set property values on current business object without raising PropertyChanged events and checking user rights. | |
Events | |
| EventHandler< SavedEventArgs >? | Saved [add, remove] |
| Event raised when an object has been saved. | |
| Events inherited from Csla.Core.ExtendedBindingList< T > | |
| EventHandler< RemovingItemEventArgs >? | RemovingItem [add, remove] |
| Implements a serialization-safe RemovingItem event. | |
| BusyChangedEventHandler? | BusyChanged [add, remove] |
| Event indicating that the busy status of the object has changed. | |
| EventHandler< ErrorEventArgs >? | UnhandledAsyncException [add, remove] |
| Event indicating that an exception occurred during an async operation. | |
| EventHandler< ChildChangedEventArgs >? | ChildChanged [add, remove] |
| Event raised when a child object has been changed. | |
| Events inherited from Csla.Core.IExtendedBindingList | |
| EventHandler< RemovingItemEventArgs >? | RemovingItem |
| Event indicating that an item is being removed from the list. | |
| Events inherited from Csla.Core.INotifyBusy | |
| BusyChangedEventHandler? | BusyChanged |
| 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. | |
This is the base class from which most business collections or lists will be derived.
| T | Type of the business object being defined. |
| C | Type of the child objects contained in the list. |
| T | : | BusinessBindingListBase | |
| T | : | T | |
| T | : | C | |
| C | : | IEditableBusinessObject |
|
inlineprotected |
Override this method to create a new object that is added to the collection.
|
inline |
Commits the current edit process.
Calling this method causes the most recently taken snapshot of the object's state to be discarded, thus committing any changes made to the object's state since the last BeginEdit call.
This method triggers an Core.BusinessBase.ApplyEdit in all child objects.
Implements Csla.Core.ISupportUndo.
|
inline |
Starts a nested edit on the object.
When this method is called the object takes a snapshot of its current state (the values of its variables). This snapshot can be restored by calling CancelEdit or committed by calling ApplyEdit.
This is a nested operation. Each call to BeginEdit adds a new snapshot of the object's state to a stack. You should ensure that for each call to BeginEdit there is a corresponding call to either CancelEdit or ApplyEdit to remove that snapshot from the stack.
See Chapters 2 and 3 for details on n-level undo and state stacking.
This method triggers the copying of all child object states.
Implements Csla.Core.ISupportUndo.
|
inlineprotected |
Creates an instance of the type.
|
inline |
Cancels the current edit process, restoring the object's state to its previous values.
Calling this method causes the most recently taken snapshot of the object's state to be restored. This resets the object's values to the point of the last BeginEdit call.
This method triggers an undo in all child objects.
Implements Csla.Core.ISupportUndo.
|
inlineprotectedvirtual |
Initializes a new instance of the object with default values.
|
inlineprotectedvirtual |
Called by the server-side DataPortal if an exception occurs during data access.
| e | The DataPortalContext object passed to the DataPortal. |
| ex | The Exception thrown during data access. |
|
inlineprotectedvirtual |
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
| e | The DataPortalContext object passed to the DataPortal. |
|
inlineprotectedvirtual |
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
| e | The DataPortalContext object passed to the DataPortal. |
|
inlineprotectedvirtual |
Handles any PropertyChanged event from a child object and echoes it up as a ListChanged event.
| ArgumentNullException | e is null. |
Reimplemented from Csla.Core.ExtendedBindingList< T >.
|
inlineprotectedvirtual |
Saves all items in the list, automatically performing insert, update or delete operations as necessary.
| parameters | Optional parameters passed to child update methods. |
| ArgumentNullException | parameters is null. |
|
inlineprotectedvirtual |
Asynchronously saves all items in the list, automatically performing insert, update or delete operations as necessary.
| parameters | Optional parameters passed to child update methods. |
| ArgumentNullException | parameters is null. |
|
inlineprotected |
Clears the collection, moving all active items to the deleted list.
|
inline |
Creates a clone of the object.
|
inline |
Returns true if the internal deleted list contains the specified child object.
| item | Child object to check. |
|
inlineprotectedvirtual |
Called by the server-side DataPortal if an exception occurs during data access.
| e | The DataPortalContext object passed to the DataPortal. |
| ex | The Exception thrown during data access. |
|
inlineprotectedvirtual |
Called by the server-side DataPortal prior to calling the requested DataPortal_xyz method.
| e | The DataPortalContext object passed to the DataPortal. |
|
inlineprotectedvirtual |
Called by the server-side DataPortal after calling the requested DataPortal_xyz method.
| e | The DataPortalContext object passed to the DataPortal. |
|
inlineprotectedvirtual |
Invoked after the object has been deserialized to allow derived classes to perform custom post-deserialization processing.Override this method in a derived class to implement actions that should occur immediately after deserialization, such as initializing transient fields or validating object state. This method is called automatically during the deserialization process.
Reimplemented from Csla.Core.ExtendedBindingList< T >.
|
inlineprotectedvirtual |
Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed.
| child | The child object that was edited. |
|
inlineprotectedvirtual |
Creates a clone of the object.
|
inlineprotectedvirtual |
Override this method to set up event handlers so user code in a partial class can respond to events raised by generated code.
|
inlineprotected |
Sets the edit level of the child object as it is added.
| index | Index of the item to insert. |
| item | Item to insert. |
| ArgumentNullException | item is null. |
|
inlineprotected |
Marks the object as being a child object.
By default all business objects are 'parent' objects. This means that they can be directly retrieved and updated into the database.
We often also need child objects. These are objects which are contained within other objects. For instance, a parent Invoice object will contain child LineItem objects.
To create a child object, the MarkAsChild method must be called as the object is created. Please see Chapter 7 for details on the use of the MarkAsChild method.
|
inlineprotected |
Override this method to insert child objects into the MobileFormatter serialization stream.
| info | Object containing the data to serialize. |
| formatter | Reference to the current SerializationFormatterFactory.GetFormatter(). |
| ArgumentNullException | info or formatter is null. |
|
inlineprotected |
Override this method to insert your field values into the MobileFormatter serialization stream.
| info | Object containing the data to serialize. |
| ArgumentNullException | info is null. |
|
inlineprotectedvirtual |
Raises the Saved event, indicating that the object has been saved, and providing a reference to the new object instance.
| newObject | The new object instance. |
| e | Exception that occurred during the operation. |
| userState | User state object. |
| ArgumentNullException | newObject is null. |
|
inlineprotected |
Override this method to get child objects from the MobileFormatter serialization stream.
| info | Object containing the serialized data. |
| formatter | Reference to the current SerializationFormatterFactory.GetFormatter(). |
| ArgumentNullException | info or formatter is null. |
|
inlineprotected |
Override this method to retrieve your field values from the MobileFormatter serialization stream.
| info | Object containing the data to serialize. |
| ArgumentNullException | info is null. |
|
inlineprotected |
Marks the child object for deletion and moves it to the collection of deleted objects.
| index | Index of the item to remove. |
|
inline |
Saves the object to the database.
Calling this method starts the save operation, causing the all child objects to be inserted, updated or deleted within the database based on the each object's current state.
All this is contingent on IsDirty. If this value is false, no data operation occurs. It is also contingent on 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 collection that contains any data updated during the save operation. You MUST update all object references to use this new version of the business collection 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 MyBase.Save().
Implements Csla.Core.ISavable.
|
inline |
Saves the object to the database, merging any resulting updates into the existing object graph.
Implements Csla.Core.ISavable.
|
inline |
Saves the object to the database.
Implements Csla.Core.ISavable.
|
inlineprotectedvirtual |
Saves the object to the database.
| userState | User state data. |
| isSync | True if the save operation should be synchronous. |
|
inlineprotected |
Replaces the item at the specified index with the specified item, first moving the original item to the deleted list.
| index | The zero-based index of the item to replace. |
| item | The new value for the item at the specified index. The value can be null for reference types. |
| ArgumentNullException | item is null. |
|
inlineprotectedvirtual |
Used by BusinessListBase as a child object is created to tell the child object about its parent.
| parent | A reference to the parent collection object. |
Implements Csla.Core.IEditableCollection.
|
inline |
Get an array containing all items in the list.
|
inline |
Await this method to ensure business object is not busy.
|
getprotected |
Gets the current ApplicationContext.
Implements Csla.Core.IUseApplicationContext.
|
getprotected |
A collection containing all child objects marked for deletion.
Implements Csla.IContainsDeletedList.
|
getprotected |
Returns the current edit level of the object.
Implements Csla.Core.IUndoableObject.
|
get |
Gets the busy status for this object and its child objects.
Implements Csla.Core.INotifyBusy.
|
get |
Indicates whether this collection object is a child object.
Implements Csla.Core.ITrackStatus.
|
get |
Gets a value indicating whether this object's data has been changed.
Implements Csla.Core.ITrackStatus.
|
get |
Returns true if this object is both dirty and valid.
Implements Csla.Core.ITrackStatus.
|
getprotected |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Implements Csla.Core.ITrackStatus.
|
get |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Implements Csla.Core.ITrackStatus.
|
get |
Provide access to the parent reference for use in child object code.
This value will be Nothing for root objects.
Implements Csla.Core.IParent.
|
addremove |
Event raised when an object has been saved.