Hello, I have a routine that has a contact list, and can send an email from that list. The list is a Sliverlight page, so I was using the AsyncSerialTask to handle the save & send calls, but I ran into an error when I am testing it from the actual silverlight page.. Here is the Async task,
public void SendContact(DealConfContacts dealConfContacts, AsyncCompletedCallback<InvokeServerMethodEventArgs> callback) { IList<DealConfContacts> confContacts = new List<DealConfContacts>(); confContacts.Add(dealConfContacts); SaveOptions saveOpt = new SaveOptions(); var task1 = AsyncSerialTask.Create(); task1.AddExceptionHandler(TestAsyncSerialTaskSerialExceptionHandler); var task2 = task1.AddAsyncSave(Manager, confContacts, saveOpt);
// This was original save, switched to AddAsyncSave, both error in same place
//var task2 = task1.AddAsyncAction<EntitySavedEventArgs>((serialArgs, callBackTo) => Manager.SaveChangesAsync(confContacts,callBackTo,null)); var task3 = task2.AddAsyncAction<InvokeServerMethodEventArgs>((serialArgs, callBackTo) => DealConfContactsAsyncBehaviors.SendConfirmAsync("SYSTEM", Manager, dealConfContacts.DealConfirmation, dealConfContacts, "email", callBackTo)); task3.Execute(callback); }
The error shows up here when the e.entities is accessed. For the record, the entity may or may not have been dirty at this point, could that be the reason for the error? that the entity was clean when save was called? (I was hoping to write one stack that could save/create the entity, but if I need to differentiate before this point if it is not saved, please let me know.)
void DomainModelEntityManager_Saved(object sender, EntitySavedEventArgs e) { if (!e.Cancelled) { if (e.Entities != null) { foreach (object item in e.Entities) { var savedItem = item as ISaved; if (savedItem != null) savedItem.SavedHandler(); } } } }
Here is the error that I am seeing:
System.ArgumentNullException was unhandled by user code Message="Value cannot be null.\r\nParameter name: source" StackTrace: at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable`1 source, Func`2 selector) at IdeaBlade.EntityModel.EntitySavedEventArgs.get_Entities() at GcsAg.DomainModel.DomainModelEntityManager.DomainModelEntityManager_Saved(Object sender, EntitySavedEventArgs e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at IdeaBlade.EntityModel.EntityManager.OnSaved(EntitySavedEventArgs args) at IdeaBlade.EntityModel.EntityManager.<SaveChangesAsyncCore>b__3c(EntitySavedEventArgs args) at IdeaBlade.EntityModel.AsyncProcessor`1.<Execute>b__1(Object x) InnerException:
thanks,
-DanW
|