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. More... | |
bool | ContainsDeleted (C item) |
Returns true if the internal deleted list contains the specified child object. 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... | |
T | Save () |
Saves the object to the database. More... | |
async Task< T > | SaveAsync () |
Saves the object to the database. More... | |
async Task | SaveAndMergeAsync () |
Saves the object to the database, merging any resulting updates into the existing object graph. More... | |
Public Member Functions inherited from Csla.Core.ObservableBindingList< C > | |
T | AddNew () |
Adds a new item to this collection. More... | |
void | AddRange (System.Collections.Generic.IEnumerable< T > range) |
Add a range of items to the list. More... | |
virtual void | OnAddedNew (T item) |
Raises the AddedNew event. 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... | |
Public Member Functions inherited from Csla.Core.IObservableBindingList | |
object | AddNew () |
Creates and adds a new item to the collection. More... | |
Public Member Functions inherited from Csla.Serialization.Mobile.ISerializationNotification | |
void | Deserialized () |
Method called on an object after deserialization is complete. More... | |
Public Member Functions inherited from Csla.Serialization.Mobile.IMobileObject | |
void | GetState (SerializationInfo info) |
Method called by MobileFormatter when an object should serialize its data. More... | |
void | GetChildren (SerializationInfo info, MobileFormatter formatter) |
Method called by MobileFormatter when an object should serialize its child references. More... | |
void | SetState (SerializationInfo info) |
Method called by MobileFormatter when an object should be deserialized. More... | |
void | SetChildren (SerializationInfo info, MobileFormatter formatter) |
Method called by MobileFormatter when an object should deserialize its child references. More... | |
Protected Member Functions | |
BusinessListBase () | |
Creates an instance of the type. 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 object | GetClone () |
Creates a clone of the object. 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 C | 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 | 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 | ClearItems () |
Clears the collection, moving all active items to the deleted list. More... | |
override void | OnGetState (SerializationInfo info) |
Method called by MobileFormatter when an object should serialize its data. More... | |
override void | OnSetState (SerializationInfo info) |
Method called by MobileFormatter when an object should be deserialized. More... | |
override void | OnGetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter) |
Method called by MobileFormatter when an object should serialize its child references. More... | |
override void | OnSetChildren (Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter) |
Method called by MobileFormatter when an object should deserialize its child references. More... | |
void | MarkAsChild () |
Marks the object as being a child object. More... | |
override void | OnDeserialized () |
Reset parent references on deserialization. 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 | Child_UpdateAsync (params object[] parameters) |
Asynchronously 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... | |
Protected Member Functions inherited from Csla.Core.ObservableBindingList< 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... | |
virtual void | Child_PropertyChanged (object sender, PropertyChangedEventArgs e) |
Handles any PropertyChanged event from a child object and echoes it up as a ChildChanged event. More... | |
override void | OnCollectionChanged (NotifyCollectionChangedEventArgs e) |
Raises the CollectionChanged event. More... | |
override void | OnGetState (SerializationInfo info) |
Override this method to get custom field values from the serialization stream. More... | |
override void | OnSetState (SerializationInfo info) |
Override this method to set custom field values into the serialization stream. More... | |
override void | SetLoadListMode (bool enabled) |
Sets the load list mode for the list More... | |
Properties | |
ApplicationContext | ApplicationContext [get] |
Gets the current ApplicationContext 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... | |
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 has changes, is valid, the user is authorized and the object is not busy. More... | |
override bool | IsBusy [get] |
Gets the busy status for this object and its child objects. 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... | |
Properties inherited from Csla.Core.ObservableBindingList< C > | |
virtual bool | SupportsChangeNotificationCore [get] |
Gets a value indicating whether this object supports change notification. More... | |
bool | AllowEdit [getprotected set] |
Gets or sets a value indicating whether data binding can automatically edit items in this collection. More... | |
bool | AllowNew [getprotected set] |
Gets or sets a value indicating whether data binding can automatically add new items to this collection. More... | |
bool | AllowRemove [getprotected set] |
Gets or sets a value indicating whether data binding can automatically remove items from this collection. More... | |
bool | RaiseListChangedEvents [getset] |
Gets or sets a value indicating whether the collection should raise changed events. More... | |
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... | |
EventHandler< AddedNewEventArgs< T > > | AddedNew |
Event raised when a new object has been added to the collection. More... | |
IDisposable | SuppressListChangedEvents [get] |
Use this object to suppress ListChangedEvents for an entire code block. More... | |
Properties inherited from Csla.IContainsDeletedList | |
IEnumerable< IEditableBusinessObject > | DeletedList [get] |
List of deleted child objects 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... | |
Properties inherited from Csla.Core.IUseApplicationContext | |
ApplicationContext | ApplicationContext [getset] |
Gets or sets the current ApplicationContext object. 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... | |
Events inherited from Csla.Core.IObservableBindingList | |
EventHandler< RemovingItemEventArgs > | RemovingItem |
Event indicating that an item is being removed from the list. More... | |
Events inherited from Csla.Core.INotifyChildChanged | |
EventHandler< ChildChangedEventArgs > | ChildChanged |
Event indictating that a child object has changed. 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 | : | BusinessListBase | |
T | : | T | |
T | : | C | |
C | : | Core.IEditableBusinessObject |
Definition at line 33 of file BusinessListBase.cs.
|
protected |
Creates an instance of the type.
Definition at line 46 of file BusinessListBase.cs.
|
protectedvirtual |
Override this method to create a new object that is added to the collection.
Reimplemented from Csla.Core.ObservableBindingList< C >.
Definition at line 307 of file BusinessListBase.cs.
void Csla.BusinessListBase< 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 268 of file BusinessListBase.cs.
void Csla.BusinessListBase< 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 226 of file BusinessListBase.cs.
void Csla.BusinessListBase< 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 247 of file BusinessListBase.cs.
|
protectedvirtual |
Initializes a new instance of the object with default values.
Definition at line 875 of file BusinessListBase.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 1083 of file BusinessListBase.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 1064 of file BusinessListBase.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 1073 of file BusinessListBase.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 888 of file BusinessListBase.cs.
|
protectedvirtual |
Asynchronously saves all items in the list, automatically performing insert, update or delete operations as necessary.
parameters | Optional parameters passed to child update methods. |
Reimplemented in Csla.Test.FieldManager.Async.ChildList.
Definition at line 912 of file BusinessListBase.cs.
|
protected |
Clears the collection, moving all active items to the deleted list.
Definition at line 428 of file BusinessListBase.cs.
T Csla.BusinessListBase< T, C >.Clone | ( | ) |
Creates a clone of the object.
Definition at line 132 of file BusinessListBase.cs.
bool Csla.BusinessListBase< 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 197 of file BusinessListBase.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 1055 of file BusinessListBase.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 1036 of file BusinessListBase.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 1045 of file BusinessListBase.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 292 of file BusinessListBase.cs.
|
protectedvirtual |
Creates a clone of the object.
Definition at line 123 of file BusinessListBase.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 72 of file BusinessListBase.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 345 of file BusinessListBase.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 721 of file BusinessListBase.cs.
|
protectedvirtual |
Reset parent references on deserialization.
Reimplemented from Csla.Core.ObservableBindingList< C >.
Definition at line 856 of file BusinessListBase.cs.
|
protected |
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. |
Definition at line 657 of file BusinessListBase.cs.
|
protected |
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. |
Definition at line 622 of file BusinessListBase.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 1172 of file BusinessListBase.cs.
|
protected |
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. |
Definition at line 678 of file BusinessListBase.cs.
|
protected |
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. |
Definition at line 638 of file BusinessListBase.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 371 of file BusinessListBase.cs.
T Csla.BusinessListBase< 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 957 of file BusinessListBase.cs.
async Task Csla.BusinessListBase< 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 1025 of file BusinessListBase.cs.
async Task< T > Csla.BusinessListBase< T, C >.SaveAsync | ( | ) |
Saves the object to the database.
Implements Csla.Core.ISavable< T >.
Definition at line 975 of file BusinessListBase.cs.
|
protectedvirtual |
Saves the object to the database.
userState | User state data. |
isSync | True if the save operation should be synchronous. |
Definition at line 985 of file BusinessListBase.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 401 of file BusinessListBase.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 1210 of file BusinessListBase.cs.
|
getprotected |
Gets the current ApplicationContext
Definition at line 52 of file BusinessListBase.cs.
|
getprotected |
A collection containing all child objects marked for deletion.
Definition at line 150 of file BusinessListBase.cs.
|
getprotected |
Returns the current edit level of the object.
Definition at line 449 of file BusinessListBase.cs.
|
get |
Gets the busy status for this object and its child objects.
Definition at line 809 of file BusinessListBase.cs.
|
get |
Indicates whether this collection object is a child object.
Definition at line 699 of file BusinessListBase.cs.
|
get |
Gets a value indicating whether this object's data has been changed.
Definition at line 742 of file BusinessListBase.cs.
|
get |
Returns true if this object has changes, is valid, the user is authorized and the object is not busy.
Definition at line 797 of file BusinessListBase.cs.
|
getprotected |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Definition at line 770 of file BusinessListBase.cs.
|
get |
Gets a value indicating whether this object is currently in a valid state (has no broken validation rules).
Definition at line 779 of file BusinessListBase.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 1196 of file BusinessListBase.cs.
|
addremove |
Event raised when an object has been saved.
Definition at line 1149 of file BusinessListBase.cs.