Is there a way to tell if an editable business object was created/fetched async? I am looking into the idea of lazy loading child lists async or sync depending on how the business object was instantiated. At first I thought of using a similar method as running business runs async or sync:
if (System.Web.HttpContext.Current != null) IsAsync = false; else IsAsync = true;
However the problem with this logic is that if running in web context then it is sync. What about running in Windows Service? I can't wait for the lazy loaded child collection to return at some point in the future and set its property since there are no UI bindings.
You would need to pass that bit of info via a criteria object. Or in ClientContext. There is no automatically passed vale that tells the server side code that the client did an async call.
Thanks, I was hoping there may have been a way with DataPortal.BeginFetch to raise an event or call a method in the business object that I could override.
I have never used ClientContext and don't know what it is or what it does. Can you point me in the right direction or which ebook covers it?
I think this should rather be a config setting on the client as to whether client data access/lazy load child should be async or sync.
I don't like the ideat that the object itself must keep track of how it was created from the client.
Remember, with the new async/await keywords in .NET 4.5/4.0 you can also use async data portal / data access in ASP.NET application and WCF services.
Then there's also at least 2 different types of async:
(This is all similar to how WCF 4.5 client and server works too!)
Copyright (c) Marimer LLC