question

VigneshGovindhan-1617 avatar image
0 Votes"
VigneshGovindhan-1617 asked ·

MVVM - Services Migration to Libraries.

We have three Projects in a solution name Data, ViewModel, App. We have a set of application services whose Interfaces are in ViewModel and classes are in App.

Example:

I have an ILogService interface in ViewModel and LogService in App. We will use ServiceLocator to bind them. We are planning to move these
services into the Library.

The questions are

  1. Do we really need both Interface and Class? or is classes are just enough?

  2. if we need both interface and class,
    a) Do we need to add them in the same library and import them to App and ViewModel?
    b) Do we need to add them to separate libraries and import Classes to App and Interfaces to ViewModel?

  3. Which is the correct way of doing it without breaking the MVVM architecture?




windows-uwp
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, are you using UWP for development? In addition, interfaces and classes have their own purposes. Different projects have different needs. You need to design a reasonable architecture according to your project, there is no uniform standard.

0 Votes 0 · ·

Yes, I am using UWP for development.

0 Votes 0 · ·
RichardZhang-MSFT avatar image RichardZhang-MSFT VigneshGovindhan-1617 ·

Hello, your problem is related to your personal code habits and the architectural design of the project. The division of interfaces and classes is mainly for code decoupling, so as to better reuse. MVVM is just a design pattern, whether you use interfaces or classes, it is feasible.

0 Votes 0 · ·
Show more comments

0 Answers