Normally you'd call UpdateChildren() inside the using statement in the root object, so all the objects reuse the same connection. The reason for this is to avoid using the DTC (and its performance hit) when using TransactionScope transactions.
Or if you are using manual transactions, it is still a good idea, because you can set up the transaction on the connection in the root, and use that same connection (with its transaction) in the child objects.
As you show your code, it is virtually impossible to get any transactional protection - or if you do, it will involve the use of the DTC, so you'll take a perf hit.
I am working in CSLA.net 4, Using a DataGrid with a BusinessListBase and BusinessBase. My fetch work nice.
To update a line in the Grid my CanSave binding works on my apply button. I use this:
<Button x:Name="ButtonApplyTop"
Width="75" Content="Apply"
IsEnabled="{Binding CanSave, Mode=OneWay}"/>
<my1:TriggerAction Height="0" x:Name="ButtonApplyTopTrigger" Width="0"
TargetControl="{Binding ElementName=ButtonApplyTop}"
TriggerEvent="Click" MethodName="Save"
/>
When I click Apply it execute the save method, i know because i ovveride it, but do not reach my Child_Update() in the BusinessBase:
private void Child_Update()
{
}
Do not even reach this in:
BusinessListBase:
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
using (var ctx = ConnectionManager<SqlConnection>.GetManager("StaffSenseDb"))
{
base.Child_Update(ctx);
//FieldManager.UpdateChildren(this);
}
}
What is wrong? Please help.
I also try this in the child object not working:
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
base.DataPortal_Update();
using (var ctx = ConnectionManager<SqlConnection>.GetManager("xxxx"))
{
}
}
VMMV Search:
public void Search()
{
Presenter.ShowStatus(new Status { IsBusy = true, Text = "Searching row calls..." });
BeginRefresh("Search");
}
Client Side:
public static void Search(EventHandler<DataPortalResult<RowCallSummaryRORL>> callback)
{
var dp = new DataPortal<RowCallSummaryRORL>();
dp.FetchCompleted += callback;
dp.BeginFetch(rowCallSummaryDateCriteria_);
}
Server side:
private void Child_Fetch(SafeDataReader dr, Business.RowCall.RowCallDetailsCriteria criteria)
{
...
}
Apply:
server side:
private void Child_Update()
{
...
}
we just had to play around with the ViewModel verbs, Server Side names and Criteria Objects content
Copyright (c) Marimer LLC