Non-PCL dependencies w/ MvvmCross -
our application has several dependencies not available pcl libraries (e.g. restsharp, websocket4net, reactive extensions), available each platform plan target. what's best approach handling scenario in mvvmcross? simplest?
there various ways approach this.
if problem large, can abandon pcl approach, , use multiple platforms specific class libraries. these libraries can reference mvvmcross pcls , platform specific versions of restsharp, etc. discussions on pro's , con's of see - what advantage of using portable class libraries instead of using "add link"?
in general, take file-linking approach if i've got include large legacy library (e.g. 1 customer had large business logic library talked 3 separate wcf services...)
some of libraries mention may have pcl ports and/or alternatives - e.g.
- reactive extensions has official pcl port - see http://blogs.msdn.com/b/rxteam/archive/2013/02/06/rx-2-1-is-here.aspx
- for simple rest calls, we've started including functionality in network plugin - see https://github.com/slodge/mvvmcross/tree/v3/plugins/cirrious/network/cirrious.mvvmcross.plugins.network/rest (warning - alpha code!)
many open source authors providing pcl versions - check.
you can abstract native libraries away behind interfaces , can inject correct version of library @ runtime. plugins within mvvmcross
you can see how lots of plugins built in https://github.com/slodge/mvvmcross/tree/v3/plugins/
there's simple plugin in sample - https://github.com/slodge/mvvmcross-tutorials/tree/master/goodvibrations
another approach can use provide 'reference assemblies' - these pcl assemblies contain type , interface signatures (i.e. provide
notimplementedexception
implementations). pcl projects link these assemblies, while ui projects link real assemblies. @ build time, pcl core build against signatures, msbuild/xbuild ensure correct native library gets pulled in.i've not used last technique in practice. prefer interface route leads better architecture. however, technique used in current mvvmcross nuget packages - know works.
Comments
Post a Comment