O'Reilly logo

Professional C# 6 and .NET Core 1.0 by Christian Nagel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

31 Patterns with XAML Apps

What’s In This Chapter?

  • Sharing Code
  • Creating Models
  • Creating Repositories
  • Creating ViewModels
  • Locators
  • Dependency Injection
  • Messaging between ViewModels
  • Using an IoC Container

Wrox.com Code Downloads for This Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples:

  • Books Desktop App (WPF)
  • Books Universal App (UWP)

Why MVVM?

Technologies and frameworks change. I created the first version of my company website (http://www.cninnovation.com) with ASP.NET Web Forms. When ASP.NET MVC came along, I tried it out to migrate a feature of my site to MVC. The progress was a lot faster than I expected. Within one day I transformed the complete site to MVC. The site uses SQL Server, integrates RSS feeds, and shows trainings and books. Information about the trainings and books is coming from the SQL Server database. The fast migration to ASP.NET MVC was only possible because I had separation of concerns from the beginning; I had created separate layers for the data access and business logic. With ASP.NET Web Forms it would have been possible to directly use data source and data controls within the ASPX page. Separating the data access and business logic took more time in the beginning, but it turned out to be a huge advantage, as it allows for unit tests and reuse. Because I had separated things this way, moving ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required