This is the base class from which most business collections or lists will be derived. More...
Public Member Functions | |
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... | |
bool | ContainsDeleted (C item) |
Returns true if the internal deleted list contains the specified child object. More... | |
T | Clone () |
Creates a clone of the object. More... | |
T | Save () |
Saves the object to the database. More... | |
async Task< T > | SaveAsync () |
Saves the object to the database. More... | |
Task | SaveAndMergeAsync () |
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 (EventHandler< SavedEventArgs > handler, object userState) |
Starts an async operation to save the object to the database. More... | |
C[] | ToArray () |
Get an array containing all items in the list. More... | |
Public Member Functions inherited from Csla.Core.ExtendedBindingList< C > | |
void | AddRange (System.Collections.Generic.IEnumerable< T > range) |
Add a range of items to the list. More... | |
Public Member Functions inherited from Csla.Core.IEditableCollection | |
void | RemoveChild (Core.IEditableBusinessObject child) |
Removes the specified child from the parent collection. More... | |
void | SetParent (IParent parent) |
Used by BusinessListBase as a child object is created to tell the child object about its parent. 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 | |
BusinessBindingListBase () | |
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 | EditChildComplete (Core.IEditableBusinessObject child) |
Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed. More... | |
override object | AddNewCore () |
Override this method to create a new object that is added to the collection. More... | |
override void | InsertItem (int index, C item) |
Sets the edit level of the child object as it is added. More... | |
override void | RemoveItem (int index) |
Marks the child object for deletion and moves it to the collection of deleted objects. More... | |
override void | ClearItems () |
Clears the collection, moving all active items to the deleted list. More... | |
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. More... | |
override void | Child_PropertyChanged (object sender, PropertyChangedEventArgs e) |
Handles any PropertyChanged event from a child object and echoes it up as a ListChanged event. More... | |
void | MarkAsChild () |
Marks the object as being a child object. More... | |
virtual object | GetClone () |
Creates a clone of the object. More... | |
override void | OnDeserialized () |
This method is called on a newly deserialized object after deserialization is complete. More... | |
virtual void | Child_Create () |
Initializes a new instance of the object with default values. More... | |
virtual void | Child_Update (params object[] parameters) |
Saves all items in the list, automatically performing insert, update or delete operations as necessary. More... | |
virtual async Task< T > | SaveAsync (object userState, bool isSync) |
Saves the object to the database. 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_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 | 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... | |
virtual void | SetParent (Core.IParent parent) |
Used by BusinessListBase as a child object is created to tell the child object about its parent. More... | |
override void | OnSetState (Csla.Serialization.Mobile.SerializationInfo info) |
Override this method to retrieve your field values from the MobileFormatter serialzation stream. More... | |
override void | OnGetState (Csla.Serialization.Mobile.SerializationInfo info) |
Override this method to insert your field values into the MobileFormatter serialzation stream. More... | |
override void | OnGetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter) |
Override this method to insert child objects into the MobileFormatter serialization stream. More... | |
override void | OnSetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter) |
Override this method to get child objects from the MobileFormatter serialization stream. More... | |
Protected Member Functions inherited from Csla.Core.ExtendedBindingList< C > | |
void | OnRemovingItem (T removedItem) |
Raise the RemovingItem event. More... | |
override void | RemoveItem (int index) |
Remove the item at the specified index. More... | |
virtual void | OnBusyChanged (BusyChangedEventArgs args) |
Override this method to be notified when the IsBusy property has changed. More... | |
void | OnBusyChanged (string propertyName, bool busy) |
Raises the BusyChanged event for a specific property. More... | |
virtual void | OnUnhandledAsyncException (ErrorEventArgs error) |
Method invoked when an unhandled async exception has occurred. More... | |
void | OnUnhandledAsyncException (object originalSender, Exception error) |
Raises the UnhandledAsyncException event. More... | |
override void | InsertItem (int index, T item) |
Invoked when an item is inserted into the list. More... | |
virtual void | OnAddEventHooks (T item) |
Method invoked when events are hooked for a child object. More... | |
virtual void | OnRemoveEventHooks (T item) |
Method invoked when events are unhooked for a child object. More... | |
virtual void | OnChildChanged (ChildChangedEventArgs e) |
Raises the ChildChanged event, indicating that a child object has been changed. More... | |
Properties | |
bool | IsDirty [get] |
Gets a value indicating whether this object's data has been changed. More... | |
virtual bool | IsSelfValid [get] |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules). More... | |
virtual bool | IsValid [get] |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules). More... | |
virtual bool | IsSavable [get] |
Returns true if this object is both dirty and valid. More... | |
MobileList< C > | DeletedList [get] |
A collection containing all child objects marked for deletion. More... | |
int | EditLevel [get] |
Returns the current edit level of the object. More... | |
bool | IsChild [get] |
Indicates whether this collection object is a child object. More... | |
EventHandler< Csla.Core.SavedEventArgs > | Saved |
Event raised when an object has been saved. More... | |
Core.IParent | Parent [get] |
Provide access to the parent reference for use in child object code. More... | |
override bool | IsBusy [get] |
Gets the busy status for this object and its child objects. More... | |
Properties inherited from Csla.Core.ExtendedBindingList< C > | |
EventHandler< RemovingItemEventArgs > | RemovingItem |
Implements a serialization-safe RemovingItem event. More... | |
BusyChangedEventHandler | BusyChanged |
Event indicating that the busy status of the object has changed. More... | |
virtual bool | IsBusy [get] |
Gets the busy status for this object and its child objects. More... | |
virtual bool | IsSelfBusy [get] |
Gets the busy status for this object. More... | |
EventHandler< ErrorEventArgs > | UnhandledAsyncException |
Event indicating that an exception occurred during an async operation. More... | |
EventHandler< Csla.Core.ChildChangedEventArgs > | ChildChanged |
Event raised when a child object has been changed. More... | |
IDisposable | SuppressListChangedEvents [get] |
Use this object to suppress ListChangedEvents for an entire code block. 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.IUndoableObject | |
int | EditLevel [get] |
Gets the current edit level of the object. 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< ErrorEventArgs > | UnhandledAsyncException |
Event indicating that an exception occurred during an asynchronous operation. More... | |
Events inherited from Csla.Core.ISavable< T > | |
EventHandler< SavedEventArgs > | Saved |
Event raised when an object has been saved. More... | |
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 | : | Core.IEditableBusinessObject |
Definition at line 26 of file BusinessBindingListBase.cs.
|
protected |
Creates an instance of the object.
Definition at line 38 of file BusinessBindingListBase.cs.
|
protected |
Override this method to create a new object that is added to the collection.
Definition at line 472 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.ApplyEdit | ( | ) |
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.
Definition at line 243 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.BeginEdit | ( | ) |
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.
Definition at line 201 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.BeginSave | ( | ) |
Starts an async operation to save the object to the database.
Implements Csla.Core.ISavable< T >.
Definition at line 903 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.BeginSave | ( | EventHandler< SavedEventArgs > | handler | ) |
Starts an async operation to save the object to the database.
handler | Method called when the operation is complete. |
Definition at line 925 of file BusinessBindingListBase.cs.
async void Csla.BusinessBindingListBase< T, C >.BeginSave | ( | EventHandler< SavedEventArgs > | handler, |
object | userState | ||
) |
Starts an async operation to save the object to the database.
handler | Method called when the operation is complete. |
userState | User state object. |
Definition at line 938 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.BeginSave | ( | object | userState | ) |
Starts an async operation to save the object to the database.
userState | User state object. |
Implements Csla.Core.ISavable< T >.
Definition at line 913 of file BusinessBindingListBase.cs.
void Csla.BusinessBindingListBase< T, C >.CancelEdit | ( | ) |
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.
Definition at line 222 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Initializes a new instance of the object with default values.
Definition at line 770 of file BusinessBindingListBase.cs.
|
protectedvirtual |
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. |
Definition at line 1028 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Called by the server-side DataPortal prior to calling the requested DataPortal_XYZ method.
e | The DataPortalContext object passed to the DataPortal. |
Definition at line 1005 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Called by the server-side DataPortal after calling the requested DataPortal_XYZ method.
e | The DataPortalContext object passed to the DataPortal. |
Definition at line 1016 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Handles any PropertyChanged event from a child object and echoes it up as a ListChanged event.
Reimplemented from Csla.Core.ExtendedBindingList< C >.
Definition at line 603 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Saves all items in the list, automatically performing insert, update or delete operations as necessary.
parameters | Optional parameters passed to child update methods. |
Definition at line 783 of file BusinessBindingListBase.cs.
|
protected |
Clears the collection, moving all active items to the deleted list.
Definition at line 550 of file BusinessBindingListBase.cs.
T Csla.BusinessBindingListBase< T, C >.Clone | ( | ) |
Creates a clone of the object.
Definition at line 729 of file BusinessBindingListBase.cs.
bool Csla.BusinessBindingListBase< T, C >.ContainsDeleted | ( | C | item | ) |
Returns true if the internal deleted list contains the specified child object.
item | Child object to check. |
Definition at line 459 of file BusinessBindingListBase.cs.
|
protectedvirtual |
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. |
Definition at line 993 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Called by the server-side DataPortal prior to calling the requested DataPortal_xyz method.
e | The DataPortalContext object passed to the DataPortal. |
Definition at line 968 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Called by the server-side DataPortal after calling the requested DataPortal_xyz method.
e | The DataPortalContext object passed to the DataPortal. |
Definition at line 980 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Override this method to be notified when a child object's Core.BusinessBase.ApplyEdit method has completed.
child | The child object that was edited. |
Definition at line 266 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Creates a clone of the object.
Definition at line 720 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Override this method to set up event handlers so user code in a partial class can respond to events raised by generated code.
Definition at line 53 of file BusinessBindingListBase.cs.
|
protected |
Sets the edit level of the child object as it is added.
index | Index of the item to insert. |
item | Item to insert. |
Definition at line 509 of file BusinessBindingListBase.cs.
|
protected |
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.
Definition at line 700 of file BusinessBindingListBase.cs.
|
protectedvirtual |
This method is called on a newly deserialized object after deserialization is complete.
Reimplemented from Csla.Core.ExtendedBindingList< C >.
Definition at line 747 of file BusinessBindingListBase.cs.
|
protected |
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(). |
Definition at line 1346 of file BusinessBindingListBase.cs.
|
protected |
Override this method to insert your field values into the MobileFormatter serialzation stream.
info | Object containing the data to serialize. |
Definition at line 1327 of file BusinessBindingListBase.cs.
|
protectedvirtual |
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 | Execption that occurred during the operation. |
userState | User state object. |
Definition at line 1132 of file BusinessBindingListBase.cs.
|
protected |
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(). |
Definition at line 1367 of file BusinessBindingListBase.cs.
|
protected |
Override this method to retrieve your field values from the MobileFormatter serialzation stream.
info | Object containing the data to serialize. |
Definition at line 1311 of file BusinessBindingListBase.cs.
|
protected |
Marks the child object for deletion and moves it to the collection of deleted objects.
index | Index of the item to remove. |
Definition at line 527 of file BusinessBindingListBase.cs.
T Csla.BusinessBindingListBase< T, C >.Save | ( | ) |
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 >.
Definition at line 827 of file BusinessBindingListBase.cs.
Task Csla.BusinessBindingListBase< T, C >.SaveAndMergeAsync | ( | ) |
Saves the object to the database, merging any resulting updates into the existing object graph.
Implements Csla.Core.ISavable< T >.
Definition at line 855 of file BusinessBindingListBase.cs.
async Task< T > Csla.BusinessBindingListBase< T, C >.SaveAsync | ( | ) |
Saves the object to the database.
Implements Csla.Core.ISavable< T >.
Definition at line 845 of file BusinessBindingListBase.cs.
|
protectedvirtual |
Saves the object to the database.
userState | User state data. |
isSync | True if the save operation should be synchronous. |
Definition at line 865 of file BusinessBindingListBase.cs.
|
protected |
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. |
Definition at line 568 of file BusinessBindingListBase.cs.
|
protectedvirtual |
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. |
Definition at line 1173 of file BusinessBindingListBase.cs.
C[] Csla.BusinessBindingListBase< T, C >.ToArray | ( | ) |
Get an array containing all items in the list.
Definition at line 1198 of file BusinessBindingListBase.cs.
|
getprotected |
A collection containing all child objects marked for deletion.
Definition at line 419 of file BusinessBindingListBase.cs.
|
getprotected |
Returns the current edit level of the object.
Definition at line 651 of file BusinessBindingListBase.cs.
|
get |
Gets the busy status for this object and its child objects.
Definition at line 1231 of file BusinessBindingListBase.cs.
|
get |
Indicates whether this collection object is a child object.
Definition at line 678 of file BusinessBindingListBase.cs.
|
get |
Gets a value indicating whether this object's data has been changed.
Definition at line 108 of file BusinessBindingListBase.cs.
|
get |
Returns true if this object is both dirty and valid.
Definition at line 168 of file BusinessBindingListBase.cs.
|
getprotected |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Definition at line 136 of file BusinessBindingListBase.cs.
|
get |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Definition at line 148 of file BusinessBindingListBase.cs.
|
get |
Provide access to the parent reference for use in child object code.
This value will be Nothing for root objects.
Definition at line 1159 of file BusinessBindingListBase.cs.
|
addremove |
Event raised when an object has been saved.
Definition at line 1097 of file BusinessBindingListBase.cs.