CSLA .NET Data Helpers for Windows Phone

CSLA .NET Data Helpers for Windows Phone

Old forum URL: forums.lhotka.net/forums/t/11129.aspx


mesh posted on Monday, February 06, 2012

Hi,

there is no CSLA .NET Data Helpers for Windows Phone? Windows Phone supports Linq To SQL CE. I think that ContextManager, DataMap, DataMapper and maybe TransactionManager should be included in Csla.Data for Windows Phone.

 

Thanks,

 

RockfordLhotka replied on Monday, February 06, 2012

That is a good observation, and we should add appropriate support for SQL CE - I'll add this to the wish list.

mesh replied on Thursday, February 09, 2012

Thanks.

I hope it will include support  for synchronous data portal methods.

RockfordLhotka replied on Thursday, February 09, 2012

It will not include support for synchronous data portal concepts, no. The idea of synchronous file or database IO is on its way out.

The new Windows Runtime (WinRT) in Windows 8 (and then Windows Phone 8 if rumor is correct) doesn't allow synchronous file or database IO.

No sense supporting a concept that is soon to be entirely gone.

In fact, what is more likely is that the .NET data portal will be changed to support async - though that'll almost certainly be done in a way that relies on the async/await keywords in .NET 4.5.

mesh replied on Thursday, February 23, 2012

Hi Rocky,

I'm reading Using CSLA 4.0: Windows Phone and can not understand how should I implement ProjectGetter's GetExistingProject method when using local database? There is no synchronous DataPortal_Fetch available.

So, how can I implement async DataPortal_Fetch(Criteria criteria, Csla.DataPortalClient.LocalProxy<ProjectGetter>.CompletedHandler handler) method and load Project and RoleList in it?

Thanks

RockfordLhotka replied on Thursday, February 23, 2012

There is no synchronous data portal in Silverlight, or the phone.

However, the client-side DataPortal_Fetch is not inherently asynchronous. It is invoked synchronously by the data portal. The requirement is that your code must invoke the callback handler when the method is complete.

The primary idea here is that you'd make an async call to a service, and when that call completes you'd invoke the handler.

But there is absolutely nothing stopping you from making a synchronous data access call and then calling the handler. Other than when your users get upset with your app anyway... Because if you do this, you'll block the user. I actually don't know exactly how badly, but probably badly.

What you should do is use a BackgroundWorker from the Csla.Threading namespace to do the data access on a background thread, and to invoke the callback handler when the background task completes. That way you won't block the user because your synchronous data access will run on that background thread.

mesh replied on Friday, February 24, 2012

Thanks.

Copyright (c) Marimer LLC