CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
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. More...
 
void Rebind ()
 Triggers WPF data binding to rebind to the data object. More...
 
void Refresh< T > (Func< T > factory)
 Refresh the ObjectInstance by calling the supplied factory. More...
 
async void Refresh< T > (Func< Task< T > > factory)
 Refresh the ObjectInstance by calling the supplied factory. More...
 
void Cancel ()
 Cancels changes to the business object, returning it to its previous state. More...
 
void Save ()
 Accepts changes to the business object, and commits them by calling the object's Save() method. More...
 
object AddNew ()
 Adds a new item to the object if the object implements IBindingList and AllowNew is true. More...
 
void RemoveItem (object sender, ExecuteEventArgs e)
 Removes an item from the list if the object implements IBindingList and AllowRemove is true. More...
 

Protected Member Functions

virtual void OnSaved (object newObject, Exception error, object userState)
 Raise the Saved event when the object has been saved. More...
 
override void BeginInit ()
 Indicates that the control is about to initialize. More...
 
override void EndInit ()
 Indicates that the control has initialized. More...
 
override void BeginQuery ()
 Overridden. More...
 

Properties

CslaDataProviderCommandManager CommandManager [get]
 Gets an object that can be used to execute Save and Undo commands on this CslaDataProvider through XAML command bindings. More...
 
Type ObjectType [getset]
 Gets or sets the type of object to create an instance of. More...
 
bool 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. More...
 
object DataChangedHandler [getset]
 Gets or sets a reference to an object that will handle the DataChanged event raised by this data provider. More...
 
string 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. More...
 
IList FactoryParameters [get]
 Get the list of parameters to pass to the factory method. More...
 
bool IsAsynchronous [getset]
 Gets or sets a value that indicates whether to perform object creation in a worker thread or in the active context. More...
 
object ObjectInstance [getset]
 Gets or sets a reference to the data object. More...
 
bool IsBusy [getprotected set]
 Gets a value indicating if this object is busy. More...
 

Events

EventHandler< Csla.Core.SavedEventArgsSaved
 Event raised when the object has been saved. More...
 

Detailed Description

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

Definition at line 26 of file CslaDataProvider.cs.

Constructor & Destructor Documentation

◆ CslaDataProvider()

Csla.Xaml.CslaDataProvider.CslaDataProvider ( )

Creates an instance of the object.

Definition at line 32 of file CslaDataProvider.cs.

Member Function Documentation

◆ AddNew()

object Csla.Xaml.CslaDataProvider.AddNew ( )

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

Definition at line 634 of file CslaDataProvider.cs.

◆ BeginInit()

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

Indicates that the control is about to initialize.

Definition at line 242 of file CslaDataProvider.cs.

◆ BeginQuery()

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

Overridden.

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

Definition at line 263 of file CslaDataProvider.cs.

◆ Cancel()

void Csla.Xaml.CslaDataProvider.Cancel ( )

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.

Definition at line 544 of file CslaDataProvider.cs.

◆ EndInit()

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

Indicates that the control has initialized.

Definition at line 251 of file CslaDataProvider.cs.

◆ OnSaved()

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

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.

Definition at line 52 of file CslaDataProvider.cs.

◆ Rebind()

void Csla.Xaml.CslaDataProvider.Rebind ( )

Triggers WPF data binding to rebind to the data object.

Definition at line 223 of file CslaDataProvider.cs.

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

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

Refresh the ObjectInstance by calling the supplied factory.

Template Parameters
TType of ObjectInstance
Parameters
factorySync data portal or factory method

Definition at line 309 of file CslaDataProvider.cs.

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

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

Refresh the ObjectInstance by calling the supplied factory.

Template Parameters
TType of ObjectInstance
Parameters
factoryAsync data portal or factory method
Returns

Definition at line 361 of file CslaDataProvider.cs.

◆ RemoveItem()

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

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.

Definition at line 655 of file CslaDataProvider.cs.

◆ Save()

void Csla.Xaml.CslaDataProvider.Save ( )

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.

Definition at line 576 of file CslaDataProvider.cs.

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.

Definition at line 79 of file CslaDataProvider.cs.

◆ 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.

Definition at line 134 of file CslaDataProvider.cs.

◆ 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.

Definition at line 156 of file CslaDataProvider.cs.

◆ FactoryParameters

IList Csla.Xaml.CslaDataProvider.FactoryParameters
get

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

Definition at line 173 of file CslaDataProvider.cs.

◆ 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.

Definition at line 186 of file CslaDataProvider.cs.

◆ IsBusy

bool Csla.Xaml.CslaDataProvider.IsBusy
getprotected set

Gets a value indicating if this object is busy.

Definition at line 209 of file CslaDataProvider.cs.

◆ 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.

Definition at line 110 of file CslaDataProvider.cs.

◆ ObjectInstance

object Csla.Xaml.CslaDataProvider.ObjectInstance
getset

Gets or sets a reference to the data object.

Definition at line 196 of file CslaDataProvider.cs.

◆ ObjectType

Type Csla.Xaml.CslaDataProvider.ObjectType
getset

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

Definition at line 91 of file CslaDataProvider.cs.

Event Documentation

◆ Saved

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

Event raised when the object has been saved.

Definition at line 43 of file CslaDataProvider.cs.