![]() |
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. | |
| Public Member Functions inherited from Csla.Core.ObservableBindingList< T > | |
| T | AddNew () |
| Adds a new item to this collection. | |
| async Task< T > | AddNewAsync () |
| Adds a new item to this collection. | |
| 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. | |
| virtual void | OnAddedNew (T item) |
| Raises the AddedNew event. | |
| SuppressListChangedEventsClass (ObservableBindingList< TC > businessObject) | |
| void | Dispose () |
| Public Member Functions inherited from Csla.Core.MobileObservableCollection< T > | |
| LoadListModeObject (IMobileList target) | |
| Create instance of type. | |
| void | Dispose () |
| Disposes the object. | |
Protected Member Functions | |||
| BusinessListBase () | |||
| 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 C | AddNewCore () | ||
| Override this method to create a new object that is added to the collection. | |||
| override async Task< C > | AddNewCoreAsync () | ||
| 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 (SerializationInfo info) | ||
| Method called by MobileFormatter when an object should serialize its data. The data should be serialized into the SerializationInfo parameter. | |||
| override void | OnSetState (SerializationInfo info) | ||
| Method called by MobileFormatter when an object should be deserialized. The data should be deserialized from the SerializationInfo parameter. | |||
| override void | OnGetChildren (SerializationInfo info, MobileFormatter formatter) | ||
| Method called by MobileFormatter when an object should serialize its child references. The data should be serialized into the SerializationInfo parameter. | |||
| override void | OnSetChildren (SerializationInfo info, MobileFormatter formatter) | ||
| Method called by MobileFormatter when an object should deserialize its child references. The data should be deserialized from the SerializationInfo parameter. | |||
| override void | OnGetMetastate (BinaryWriter writer) | ||
Override this method to write field values directly to a binary stream for metastate serialization.
| |||
| override void | OnSetMetastate (BinaryReader reader) | ||
Override this method to read field values directly from a binary stream for metastate deserialization.
| |||
| 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. | |||
| Protected Member Functions inherited from Csla.Core.ObservableBindingList< 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. | |||
| virtual void | Child_PropertyChanged (object? sender, PropertyChangedEventArgs e) | ||
| Handles any PropertyChanged event from a child object and echoes it up as a ChildChanged event. | |||
| override void | OnCollectionChanged (NotifyCollectionChangedEventArgs e) | ||
| Raises the CollectionChanged event. | |||
| override void | OnGetState (SerializationInfo info) | ||
| Override this method to get custom field values from the serialization stream. | |||
| override void | OnSetState (SerializationInfo info) | ||
| Override this method to set custom field values into the serialization stream. | |||
| override void | OnGetMetastate (BinaryWriter writer) | ||
Override this method to write field values directly to a binary stream for metastate serialization.
| |||
| override void | OnSetMetastate (BinaryReader reader) | ||
Override this method to read field values directly from a binary stream for metastate deserialization.
| |||
| override void | SetLoadListMode (bool enabled) | ||
| Sets the load list mode for the list. | |||
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 has changes, is valid, the user is authorized and the object is not busy. | |
| 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.ObservableBindingList< T > | |
| virtual bool | SupportsChangeNotificationCore [get] |
| Gets a value indicating whether this object supports change notification. | |
| bool | AllowEdit [get, protected set] |
| Gets or sets a value indicating whether data binding can automatically edit items in this collection. | |
| bool | AllowNew [get, protected set] |
| Gets or sets a value indicating whether data binding can automatically add new items to this collection. | |
| bool | AllowRemove [get, protected set] |
| Gets or sets a value indicating whether data binding can automatically remove items from this collection. | |
| bool | RaiseListChangedEvents [get, set] |
| Gets or sets a value indicating whether the collection should raise changed events. | |
| 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.MobileObservableCollection< 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.ObservableBindingList< 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. | |
| EventHandler< AddedNewEventArgs< T > >? | AddedNew [add, remove] |
| Event raised when a new object has been added to the collection. | |
| Events inherited from Csla.Core.IObservableBindingList | |
| 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< 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 | : | BusinessListBase | |
| T | : | T | |
| T | : | C | |
| C | : | IEditableBusinessObject |
|
inlineprotectedvirtual |
Override this method to create a new object that is added to the collection.
Reimplemented from Csla.Core.ObservableBindingList< T >.
|
inlineprotectedvirtual |
Override this method to create a new object that is added to the collection.
Reimplemented from Csla.Core.ObservableBindingList< T >.
|
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.
|
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.
|
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.
|
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 |
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. |
| ArgumentNullException | item is null. |
|
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.ObservableBindingList< 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.
|
inlineprotectedvirtual |
Method called by MobileFormatter when an object should serialize its child references. The data should be serialized into the SerializationInfo parameter.
| info | Object to contain the serialized data. |
| formatter | Reference to the formatter performing the serialization. |
| ArgumentNullException | info or formatter is null. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
inlineprotectedvirtual |
Override this method to write field values directly to a binary stream for metastate serialization.
| writer | Binary writer for the output stream. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
inlineprotectedvirtual |
Method called by MobileFormatter when an object should serialize its data. The data should be serialized into the SerializationInfo parameter.
| info | Object to contain the serialized data. |
| ArgumentNullException | info is null. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
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. |
|
inlineprotectedvirtual |
Method called by MobileFormatter when an object should deserialize its child references. The data should be deserialized from the SerializationInfo parameter.
| info | Object containing the serialized data. |
| formatter | Reference to the formatter performing the deserialization. |
| ArgumentNullException | info or formatter is null. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
inlineprotectedvirtual |
Override this method to read field values directly from a binary stream for metastate deserialization.
| reader | Binary reader for the input stream. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
inlineprotectedvirtual |
Method called by MobileFormatter when an object should be deserialized. The data should be deserialized from the SerializationInfo parameter.
| info | Object containing the serialized data. |
| ArgumentNullException | info is null. |
Reimplemented from Csla.Core.MobileObservableCollection< T >.
|
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< T >.
|
inline |
Saves the object to the database, merging any resulting updates into the existing object graph.
Implements Csla.Core.ISavable< T >.
|
inline |
Saves the object to the database.
Implements Csla.Core.ISavable< T >.
|
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. |
|
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.
|
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.
|
get |
Gets a value indicating whether this object's data has been changed.
|
get |
Returns true if this object has changes, is valid, the user is authorized and the object is not busy.
|
getprotected |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
|
get |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
|
get |
Provide access to the parent reference for use in child object code.
This value will be Nothing for root objects.
|
addremove |
Event raised when an object has been saved.