CSLA .NET 10.0.0
A home for your business logic
Loading...
Searching...
No Matches
Csla.Xaml.CslaDataProvider Class Reference

Wraps and creates a CSLA .NET-style object that you can use as a binding source. More...

Inheritance diagram for Csla.Xaml.CslaDataProvider:

Public Member Functions

 CslaDataProvider ()
 Creates an instance of the object.
void Rebind ()
 Triggers WPF data binding to rebind to the data object.
void Refresh< T > (Func< T > factory)
 Refresh the ObjectInstance by calling the supplied factory.
async Task Refresh< T > (Func< Task< T > > factory)
 Refresh the ObjectInstance by calling the supplied factory asynchronously.
void Cancel ()
 Cancels changes to the business object, returning it to its previous state.
void Save ()
 Accepts changes to the business object, and commits them by calling the object's Save() method.
object? AddNew ()
 Adds a new item to the object if the object implements IBindingList and AllowNew is true.
void RemoveItem (object? sender, ExecuteEventArgs e)
 Removes an item from the list if the object implements IBindingList and AllowRemove is true.

Protected Member Functions

virtual void OnSaved (object newObject, Exception? error, object? userState)
 Raise the Saved event when the object has been saved.
override void BeginInit ()
 Indicates that the control is about to initialize.
override void EndInit ()
 Indicates that the control has initialized.
override void BeginQuery ()
 Overridden. Starts to create the requested object, either immediately or on a background thread, based on the value of the IsAsynchronous property.

Properties

CslaDataProviderCommandManager CommandManager [get]
 Gets an object that can be used to execute Save and Undo commands on this CslaDataProvider through XAML command bindings.
Type? ObjectType [get, set]
 Gets or sets the type of object to create an instance of.
bool ManageObjectLifetime [get, set]
 Gets or sets a value indicating whether the data control should manage the lifetime of the business object, including using n-level undo.
object? DataChangedHandler [get, set]
 Gets or sets a reference to an object that will handle the DataChanged event raised by this data provider.
string FactoryMethod [get, set]
 Gets or sets the name of the static (Shared in Visual Basic) factory method that should be called to create the object instance.
IList FactoryParameters [get]
 Get the list of parameters to pass to the factory method.
bool IsAsynchronous [get, set]
 Gets or sets a value that indicates whether to perform object creation in a worker thread or in the active context.
object? ObjectInstance [get, set]
 Gets or sets a reference to the data object.
bool IsBusy [get, protected set]
 Gets a value indicating if this object is busy.

Events

EventHandler< SavedEventArgs >? Saved
 Event raised when the object has been saved.

Detailed Description

Wraps and creates a CSLA .NET-style object that you can use as a binding source.

Constructor & Destructor Documentation

◆ CslaDataProvider()

Csla.Xaml.CslaDataProvider.CslaDataProvider ( )
inline

Creates an instance of the object.

Member Function Documentation

◆ AddNew()

object? Csla.Xaml.CslaDataProvider.AddNew ( )
inline

Adds a new item to the object if the object implements IBindingList and AllowNew is true.

◆ BeginInit()

override void Csla.Xaml.CslaDataProvider.BeginInit ( )
inlineprotected

Indicates that the control is about to initialize.

◆ BeginQuery()

override void Csla.Xaml.CslaDataProvider.BeginQuery ( )
inlineprotected

Overridden. Starts to create the requested object, either immediately or on a background thread, based on the value of the IsAsynchronous property.

◆ Cancel()

void Csla.Xaml.CslaDataProvider.Cancel ( )
inline

Cancels changes to the business object, returning it to its previous state.

This metod does nothing unless ManageLifetime is set to true and the object supports n-level undo.

◆ EndInit()

override void Csla.Xaml.CslaDataProvider.EndInit ( )
inlineprotected

Indicates that the control has initialized.

◆ OnSaved()

virtual void Csla.Xaml.CslaDataProvider.OnSaved ( object newObject,
Exception? error,
object? userState )
inlineprotectedvirtual

Raise the Saved event when the object has been saved.

Parameters
newObjectNew object reference as a result of the save operation.
errorReference to an exception object if an error occurred.
userStateReference to a userstate object.
Exceptions
ArgumentNullExceptionnewObject is null.

◆ Rebind()

void Csla.Xaml.CslaDataProvider.Rebind ( )
inline

Triggers WPF data binding to rebind to the data object.

◆ Refresh< T >() [1/2]

void Csla.Xaml.CslaDataProvider.Refresh< T > ( Func< T > factory)
inline

Refresh the ObjectInstance by calling the supplied factory.

Template Parameters
TType of ObjectInstance
Parameters
factorySync data portal or factory method
Exceptions
ArgumentNullExceptionfactory is null.

◆ Refresh< T >() [2/2]

async Task Csla.Xaml.CslaDataProvider.Refresh< T > ( Func< Task< T > > factory)
inline

Refresh the ObjectInstance by calling the supplied factory asynchronously.

Template Parameters
TType of ObjectInstance
Parameters
factoryAsync data portal or factory method
Returns
A Task representing the asynchronous refresh operation.
Exceptions
ArgumentNullExceptionfactory is null.

◆ RemoveItem()

void Csla.Xaml.CslaDataProvider.RemoveItem ( object? sender,
ExecuteEventArgs e )
inline

Removes an item from the list if the object implements IBindingList and AllowRemove is true.

Parameters
senderObject invoking this method.
eExecuteEventArgs, where MethodParameter contains the item to be removed from the list.
Exceptions
ArgumentNullExceptione is null.

◆ Save()

void Csla.Xaml.CslaDataProvider.Save ( )
inline

Accepts changes to the business object, and commits them by calling the object's Save() method.

This method does nothing unless the object implements Csla.Core.ISavable.

If the object implements IClonable, it will be cloned, and the clone will be saved.

If the object supports n-level undo and ManageLifetime is true, then this method will automatically call ApplyEdit() and BeginEdit() appropriately.

Property Documentation

◆ CommandManager

CslaDataProviderCommandManager Csla.Xaml.CslaDataProvider.CommandManager
get

Gets an object that can be used to execute Save and Undo commands on this CslaDataProvider through XAML command bindings.

◆ DataChangedHandler

object? Csla.Xaml.CslaDataProvider.DataChangedHandler
getset

Gets or sets a reference to an object that will handle the DataChanged event raised by this data provider.

This property is designed to reference an IErrorDialog control.

◆ FactoryMethod

string Csla.Xaml.CslaDataProvider.FactoryMethod
getset

Gets or sets the name of the static (Shared in Visual Basic) factory method that should be called to create the object instance.

Exceptions
ArgumentNullExceptionFactoryMethod is null.

◆ FactoryParameters

IList Csla.Xaml.CslaDataProvider.FactoryParameters
get

Get the list of parameters to pass to the factory method.

◆ IsAsynchronous

bool Csla.Xaml.CslaDataProvider.IsAsynchronous
getset

Gets or sets a value that indicates whether to perform object creation in a worker thread or in the active context.

◆ IsBusy

bool Csla.Xaml.CslaDataProvider.IsBusy
getprotected set

Gets a value indicating if this object is busy.

◆ ManageObjectLifetime

bool Csla.Xaml.CslaDataProvider.ManageObjectLifetime
getset

Gets or sets a value indicating whether the data control should manage the lifetime of the business object, including using n-level undo.

◆ ObjectInstance

object? Csla.Xaml.CslaDataProvider.ObjectInstance
getset

Gets or sets a reference to the data object.

◆ ObjectType

Type? Csla.Xaml.CslaDataProvider.ObjectType
getset

Gets or sets the type of object to create an instance of.

Event Documentation

◆ Saved

EventHandler<SavedEventArgs>? Csla.Xaml.CslaDataProvider.Saved

Event raised when the object has been saved.


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