Question

I am new to MVVMCross (and MVVM in general). I would like some architectural advice before I start coding.

I am porting a couple legacy applications. They share a large amount of business logic. I was going to expose this logic as a service. My questions (so far):

  1. Is there a correct way of doing this that I don't know about yet?

  2. If I place the interface/implementation classes in a separate project outside of either Application's core library, and reference it from both core projects will the DI still locate the service?

  3. Similarly if the service needs to publish messsages (eg errors), will the framework handle this?

  4. Platform specific code - my understanding is that platform specific code should go into the View project (not fond of this idea), but how would this externally located service implement platform specific code?

Was it helpful?

Solution

I think you might be able to get some advice from:

Specific answers:

  1. Sounds reasonable - but this is just just c# so you can use any C# code pattern you want to.
  2. Yes - see example in the wiki - https://github.com/MvvmCross/MvvmCross/wiki/Service-Location-and-Inversion-of-Control
  3. It's up to you to provide your own error routing and handling - there are examples available - e.g. http://slodge.blogspot.co.uk/2012/05/one-pattern-for-error-handling-in.html and Display Error or Information from ViewModel to View - but this is just C# code
  4. One idea is to build "plugins" - see https://github.com/MvvmCross/MvvmCross/wiki/Service-Location-and-Inversion-of-Control (and there's an N+1 video on this too in http://mvvmcross.wordpress.com)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top