We are using Csla 4.1, Silverlight 4 and MVVM.
We have some custom validations that depends on two different business objects,
I want to know if it is possible to send a parameter to the DataPortal_Create(), something like the following:
So in my view model i will call the Business.Client method as follows:
public ParticipantVM(string compId)
{ BeginRefresh("NewParticipant", compId); }
On the Business.Client side i want to do a call similar to the following;
public static void NewParticipant(string compId, EventHandler<DataPortalResult<Participant>> callback)
{
var dp = new DataPortal<Participant>();
dp.CreateCompleted += callback;
dp.BeginCreate(); <-- This is where i want to pass the parameter like this dp.BeginCreate(compId);
}
Then obviously on the Business.Server side I want to catch it:
protected override void DataPortal_Create(string compId)
{}
Can someone please me if this is possible and how to achieve it.
Thanks
Is there any way to send parameters to the DataPortal_Create(), if i try is tells me there is no override for DataPortal_Crate(params)
Hi!
Of course there is no override, Rocky doesn't know your virtual methods signature required in BusinessBase in order to support your scenarios, plus mine, and theirs... But he uses reflection to find a signature that must look like this if you pass one string parameter for example :
protected void DataPortal_Create(string name) { }
Is it possible to pass multiple parameters in create function ?
I'm afraid you can't do it: just one parameter allowed.
If you need to pass several parameters build a Criteria Class with where the class properties are your parameters. If you are using Silverlight, make sure that the Criteria Class inherits from CriteriaBase or even BusinessBase.
P.S. - If you are using Silverlight, you must also pass the parameter
Csla.DataPortalClient.LocalProxy<Doc>.CompletedHandler handle
[Edit]
Please refer to http://forums.lhotka.net/forums/p/10506/49151.aspx#49151
[Edit end]
Copyright (c) Marimer LLC