Portable Library Tools Support would be nice

Portable Library Tools Support would be nice

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


csmith1 posted on Tuesday, October 25, 2011

I stumbled across Microsoft Portable Library Tools

http://msdn.microsoft.com/en-us/library/gg597391.aspx

http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981/

It would be nice if CSLA models could support the Portable Library Tools. One complied library that support everything from .Net to WP7. I think I saw this was support by WinRT as well.

RockfordLhotka replied on Tuesday, October 25, 2011

Yes, this would be nice, and it is something we've discussed.

The challenge, is that the result isn't 100% desirable.

All platform-specific code must be factored out of the portable assembly into platform-specific assemblies. Or all code in the framework must only use features available in the least advanced platform (lowest-common-denominator).

For example, right now the .NET Csla.dll uses some of the new .NET 4 threading features, but those features aren't on SL/WP. Even when they are in SL, they won't be in WP. Or, conversely, WinRT has some new threading features that aren't in .NET/SL/WP.

So, we can factor out all code that uses those threading features to create Csla.Net.dll, Csla.Sl.dll, etc. - and Csla.dll can use MEF or dynamic type loading to pull in the appropriate implementation per-platform.

But that means you'd reference Csla.dll and you'd have to reference the platform-specific assembly that contains the platform-specific providers. So you don't gain anything, because you are still stuck referencing a platform-specific assembly just like today.

Or, we can only use the features available in Windows Phone, because it is the lowest common denominator. This means .NET server code can't benefit from the faster/better threading features, and it means we wouldn't be able to support async/await for (probably) several years until WP gets that feature.

The async/await stuff is particularly problematic, because in CSLA 4 version 4.5 we'll expose async methods directly - at least for the data portal - but those features will only work on .NET 4.5, not on the phone, and I don't think SL5 has those keywords yet either (need to check on that).

In summary - I absolutely agree that having a portable library would be wonderful. I just don't see how to use the concept without giving up too much access to per-platform features.

Copyright (c) Marimer LLC