CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.DynamicListBase< T > Class Template Referenceabstract

This is the base class from which collections of editable root business objects should be derived. More...

Inheritance diagram for Csla.DynamicListBase< T >:
Csla.Core.ObservableBindingList< T > Csla.Core.IParent Csla.Core.IBusinessObject Csla.Core.IUseApplicationContext Csla.Core.MobileObservableCollection< T > Csla.Core.IObservableBindingList Csla.Core.INotifyBusy Csla.Core.INotifyChildChanged Csla.Serialization.Mobile.ISerializationNotification Csla.Core.ICslaObject Csla.Serialization.Mobile.IMobileList Csla.Serialization.Mobile.IMobileObjectMetastate Csla.Core.INotifyUnhandledAsyncException Csla.Serialization.Mobile.IMobileObject

Public Member Functions

Task SaveItemAsync (T item)
 Saves the specified item in the list.
Task SaveItemAsync (int index)
 Saves the specified item in the list.
virtual async Task RemoveItemAsync (int index)
 Removes an item from the list.
async Task WaitForIdle ()
 Await this method to ensure business object is not busy.
T[] ToArray ()
 Get an array containing all items in the list.
Public Member Functions inherited from Csla.Core.ObservableBindingList< 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

 DynamicListBase ()
 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 void OnSaved (T newObject, Exception? error)
 Raises the Saved event.
virtual async Task SaveItemAsync (int index, bool delete)
 Saves the specified item in the list.
override T AddNewCore ()
 Adds a new item to the list.
override async Task< T > AddNewCoreAsync ()
 Adds a new item to the list.
override void InsertItem (int index, T item)
 Gives the new object a parent reference to this list.
override async void RemoveItem (int index)
 Removes an item from the list.
override void SetItem (int index, T item)
 Replaces item in the list.
override void OnCollectionChanged (NotifyCollectionChangedEventArgs e)
 Raises the CollectionChanged event.
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.
override void OnGetState (SerializationInfo info)
 Override this method to insert your field values into the MobileFormatter serialization stream.
override void OnSetState (SerializationInfo info)
 Override this method to retrieve your field values from the MobileFormatter serialization stream.
override void OnGetMetastate (BinaryWriter writer)
 Override this method to write field values directly to a binary stream for metastate serialization.
Parameters
writerBinary writer for the output stream.

override void OnSetMetastate (BinaryReader reader)
 Override this method to read field values directly from a binary stream for metastate deserialization.
Parameters
readerBinary reader for the input stream.

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 Deserialized ()
 Invoked after the object has been deserialized to allow derived classes to perform custom post-deserialization processing.
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.
Parameters
writerBinary writer for the output stream.

override void OnSetMetastate (BinaryReader reader)
 Override this method to read field values directly from a binary stream for metastate deserialization.
Parameters
readerBinary reader for the input stream.

override void SetLoadListMode (bool enabled)
 Sets the load list mode for the list.
Protected Member Functions inherited from Csla.Core.MobileObservableCollection< T >
virtual void OnGetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to get custom child object values from the serialization stream.
virtual void OnSetChildren (SerializationInfo info, MobileFormatter formatter)
 Override this method to set custom child object values into the serialization stream.

Properties

ApplicationContext ApplicationContext [get]
 Gets the current ApplicationContext.
bool RaiseReplaceEvents [get, set]
 Gets or sets a value indicating whether the Replace event should be raised when OnCollectionChanged() is called.
override bool SupportsChangeNotificationCore [get]
 Gets a value indicating whether this collection supports change notification (always returns true).
override bool IsBusy [get]
 Gets a value indicating whether this object or any child object is currently executing an async operation.
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
 Event raised when an object in the list has been saved.
Events inherited from Csla.Core.ObservableBindingList< T >
EventHandler< RemovingItemEventArgs >? RemovingItem [add, remove]
 Implements a serialization-safe RemovingItem event.
BusyChangedEventHandlerBusyChanged [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
BusyChangedEventHandlerBusyChanged
 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.

Detailed Description

This is the base class from which collections of editable root business objects should be derived.

Template Parameters
TType of editable root object to contain within the collection.

Your subclass should implement a factory method and should override or overload DataPortal_Fetch() to implement data retrieval.

Saving (inserts or updates) of items in the collection should be handled through the SaveItem() method on the collection.

Removing an item from the collection through Remove() or RemoveAt() causes immediate deletion of the object, by calling the object's Delete() and Save() methods.

Type Constraints
T :IEditableBusinessObject 
T :IUndoableObject 
T :ISavable 
T :IMobileObject 
T :IBusinessObject 

Member Function Documentation

◆ AddNewCore()

override T Csla.DynamicListBase< T >.AddNewCore ( )
inlineprotectedvirtual

Adds a new item to the list.

Returns
The added object

Reimplemented from Csla.Core.ObservableBindingList< T >.

◆ AddNewCoreAsync()

override async Task< T > Csla.DynamicListBase< T >.AddNewCoreAsync ( )
inlineprotectedvirtual

Adds a new item to the list.

Returns
The added object

Reimplemented from Csla.Core.ObservableBindingList< T >.

◆ DataPortal_OnDataPortalException()

virtual void Csla.DynamicListBase< T >.DataPortal_OnDataPortalException ( DataPortalEventArgs e,
Exception ex )
inlineprotectedvirtual

Called by the server-side DataPortal if an exception occurs during data access.

Parameters
eThe DataPortalContext object passed to the DataPortal.
exThe Exception thrown during data access.

◆ DataPortal_OnDataPortalInvoke()

virtual void Csla.DynamicListBase< T >.DataPortal_OnDataPortalInvoke ( DataPortalEventArgs e)
inlineprotectedvirtual

Called by the server-side DataPortal prior to calling the requested DataPortal_xyz method.

Parameters
eThe DataPortalContext object passed to the DataPortal.

◆ DataPortal_OnDataPortalInvokeComplete()

virtual void Csla.DynamicListBase< T >.DataPortal_OnDataPortalInvokeComplete ( DataPortalEventArgs e)
inlineprotectedvirtual

Called by the server-side DataPortal after calling the requested DataPortal_xyz method.

Parameters
eThe DataPortalContext object passed to the DataPortal.

◆ DynamicListBase()

Csla.DynamicListBase< T >.DynamicListBase ( )
inlineprotected

Creates an instance of the type.

◆ Initialize()

virtual void Csla.DynamicListBase< T >.Initialize ( )
inlineprotectedvirtual

Override this method to set up event handlers so user code in a partial class can respond to events raised by generated code.

◆ InsertItem()

override void Csla.DynamicListBase< T >.InsertItem ( int index,
T item )
inlineprotected

Gives the new object a parent reference to this list.

Parameters
indexIndex at which to insert the item.
itemItem to insert.
Exceptions
ArgumentNullExceptionitem is null.

◆ OnCollectionChanged()

override void Csla.DynamicListBase< T >.OnCollectionChanged ( NotifyCollectionChangedEventArgs e)
inlineprotected

Raises the CollectionChanged event.

Parameters
eEvent args object
Exceptions
ArgumentNullExceptione is null.

◆ OnGetMetastate()

override void Csla.DynamicListBase< T >.OnGetMetastate ( BinaryWriter writer)
inlineprotectedvirtual

Override this method to write field values directly to a binary stream for metastate serialization.

Parameters
writerBinary writer for the output stream.

Reimplemented from Csla.Core.MobileObservableCollection< T >.

◆ OnGetState()

override void Csla.DynamicListBase< T >.OnGetState ( SerializationInfo info)
inlineprotectedvirtual

Override this method to insert your field values into the MobileFormatter serialization stream.

Parameters
infoObject containing the data to serialize.
Exceptions
ArgumentNullExceptioninfo is null.

Reimplemented from Csla.Core.MobileObservableCollection< T >.

◆ OnSaved()

virtual void Csla.DynamicListBase< T >.OnSaved ( T newObject,
Exception? error )
inlineprotectedvirtual

Raises the Saved event.

Parameters
newObjectObject returned as a result of the save operation.
errorException returned as a result of the save operation.

◆ OnSetMetastate()

override void Csla.DynamicListBase< T >.OnSetMetastate ( BinaryReader reader)
inlineprotectedvirtual

Override this method to read field values directly from a binary stream for metastate deserialization.

Parameters
readerBinary reader for the input stream.

Reimplemented from Csla.Core.MobileObservableCollection< T >.

◆ OnSetState()

override void Csla.DynamicListBase< T >.OnSetState ( SerializationInfo info)
inlineprotectedvirtual

Override this method to retrieve your field values from the MobileFormatter serialization stream.

Parameters
infoObject containing the data to serialize.
Exceptions
ArgumentNullExceptioninfo is null.

Reimplemented from Csla.Core.MobileObservableCollection< T >.

◆ RemoveItem()

override async void Csla.DynamicListBase< T >.RemoveItem ( int index)
inlineprotected

Removes an item from the list.

Parameters
indexIndex of the item to be removed.

◆ RemoveItemAsync()

virtual async Task Csla.DynamicListBase< T >.RemoveItemAsync ( int index)
inlinevirtual

Removes an item from the list.

Parameters
indexIndex of the item to be removed.

◆ SaveItemAsync() [1/3]

Task Csla.DynamicListBase< T >.SaveItemAsync ( int index)
inline

Saves the specified item in the list.

Parameters
indexIndex of item to be saved.

◆ SaveItemAsync() [2/3]

virtual async Task Csla.DynamicListBase< T >.SaveItemAsync ( int index,
bool delete )
inlineprotectedvirtual

Saves the specified item in the list.

Parameters
indexIndex of item to be saved.
deletetrue if the item should be deleted.

◆ SaveItemAsync() [3/3]

Task Csla.DynamicListBase< T >.SaveItemAsync ( T item)
inline

Saves the specified item in the list.

Parameters
itemItem to be saved.
Exceptions
ArgumentNullExceptionitem is null.

◆ SetItem()

override void Csla.DynamicListBase< T >.SetItem ( int index,
T item )
inlineprotected

Replaces item in the list.

Parameters
indexIndex of the item that was replaced.
itemNew item.
Exceptions
ArgumentNullExceptionitem is null.

◆ ToArray()

T[] Csla.DynamicListBase< T >.ToArray ( )
inline

Get an array containing all items in the list.

◆ WaitForIdle()

async Task Csla.DynamicListBase< T >.WaitForIdle ( )
inline

Await this method to ensure business object is not busy.

Property Documentation

◆ ApplicationContext

ApplicationContext Csla.DynamicListBase< T >.ApplicationContext
getprotected

◆ IsBusy

override bool Csla.DynamicListBase< T >.IsBusy
get

Gets a value indicating whether this object or any child object is currently executing an async operation.

Implements Csla.Core.INotifyBusy.

◆ RaiseReplaceEvents

bool Csla.DynamicListBase< T >.RaiseReplaceEvents
getsetprotected

Gets or sets a value indicating whether the Replace event should be raised when OnCollectionChanged() is called.

There's a bug in DataGridDataConnection that throws an exception on the replace action. By default we disable raising the replace event to avoid that bug, but some other datagrid controls require the event.

◆ SupportsChangeNotificationCore

override bool Csla.DynamicListBase< T >.SupportsChangeNotificationCore
getprotected

Gets a value indicating whether this collection supports change notification (always returns true).

Event Documentation

◆ Saved

EventHandler<SavedEventArgs>? Csla.DynamicListBase< T >.Saved

Event raised when an object in the list has been saved.


The documentation for this class was generated from the following file: