AddNewCore to Async call EC Child_CreateAddNewCore to Async call EC Child_Create
Old forum URL: forums.lhotka.net/forums/t/7531.aspx
lds posted on Friday, August 28, 2009
I'm having hard time figuring out how to code the ECL AddNewCore method in Silverlight to Asynchronously call the EC Child_Create on the server side so that I can initialize some properties with data from the database.
I have the following but the EC Child_Create does not get called.
ECL - Silverlight (.Client)
protected override void AddNewCore()
{
var child = DataPortal.CreateChild<EmployeeType>();
Add(child);
}
EC - .Net (.Server)
protected override void Child_Create()
{
// Initialize some Properties with values from Database;
}
Can anyone shed some light on the subject?
Thanks
rfcdejong replied on Saturday, August 29, 2009
It Silverlight it should be possible, but in WPF it isn't possible to implement Async behavior in the AddNewCode()
I asked this question before:
http://forums.lhotka.net/forums/thread/34910.aspx
I didn't try to figure it out in Silverlight, so i don't know how it should be done. If u fixed your problem i would like to hear the solution for it.sergeyb replied on Saturday, August 29, 2009
It is possible to do in Silverlight
ECL:
Protected override AddNewCore()
{
EC.NewEC((o,e)=>
{
If (e.Error == null)
{
Add(e.NewObject;
OnAddedNew(e.NewObject)
}
Else
{
//Do your error handling here
}
}
}
EC
Internal void NewEC(EventHandler> completed)
{
DataPortal dp = new DataPortal;
dp.CreateCompleted = completed;
dp.BeginCreate();
}
In ECL you could use a spate event handler instead of lambda expression if you would like
Sergey Barskiy
Principal Consultant
office: 678.405.0687 | mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation
-----Original Message-----
From: rfcdejong [mailto:cslanet@lhotka.net]
Sent: Saturday, August 29, 2009 6:08 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] AddNewCore to Async call EC Child_Create
It isn't possible to implement Async behavior in the AddNewCode()
I asked this question before:
http://forums.lhotka.net/forums/thread/34910.aspx
lds replied on Monday, August 31, 2009
Thanks Sergeyb that helped a lot...
I'm wondering if you could answer one more:
If the EC: DataPortal_Create() is used instead of Child_Create() what MarkX() should be used beside MarkAsChild()?
lds
Copyright (c) Marimer LLC