Enterprise Application Patterns using Xamarin.Forms ebook

Related Samples:
Related Links:

Let us know how you feel about this

Translation Quality


last updated: 2017-06

Architectural guidance for developing adaptable, maintainable, and testable Xamarin.Forms enterprise applications

This ebook provides guidance is provided on how to implement the Model-View-ViewModel (MVVM) pattern, dependency injection, navigation, validation, and configuration management, while maintaining loose coupling. In addition, there's also guidance on performing authentication and authorization with IdentityServer, accessing data from containerized microservices, and unit testing.

Free eBook Download (2Mb PDF)

Developers of enterprise mobile applications face several challenges, including:

  • Application requirements that can change over time.
  • New business opportunities and challenges.
  • Ongoing feedback during development that can significantly affect the scope and requirements of the application.

With these challenges in mind, it’s important to build mobile applications that are both flexible and that can be easily modified or extended over time. Designing for such flexibility can be difficult, as it requires an architecture that allows individual parts of the application to be independently developed and tested in isolation without affecting the rest of the application

The traditional approach to designing and building an application results in what is referred to as a monolithic application, where components are tightly coupled with no clear separation between them. Typically, this monolithic approach leads to applicationss that are difficult and inefficient to maintain, because it can be difficult to resolve bugs without breaking other components in the application, and it can also be difficult to add new features or replace existing features.

An effective remedy for these challenges is to partition an application into discrete, loosely coupled components that can easily be integrated together into an application. Such an approach offers the following benefits:

  • It allows individual functionality to be developed, tested, extended, and maintained by different individuals or teams.
  • It promotes reuse and a clean separation of concerns between the application’s horizontal capabilities, such as authentication and data access, and vertical capabilities, such as application specific business functionality. This allows the dependencies and interactions between application components to be more easily managed.
  • It helps maintain a separation of roles by allowing different individuals or teams to focus on a specific task or piece of functionality according to their expertise. In particular, it provides a cleaner separation between the user interface and the application’s business logic.

However, there are many issues that must be resolved when partitioning an application. These include:

  • Deciding how to provide a clean separation of concerns between the user interface controls and their logic.
  • Deciding whether to use a dependency injection container.
  • Choosing how components that are inconvenient to link by object and type references can communicate.
  • Deciding how to navigate between pages, including how to invoke navigation and where navigation logic should reside.
  • Deciding how to validate user input for correctness. The decision must include how to validate user input and how to notify the user about validation errors.
  • Deciding how to perform authentication and how to protect resources with authorization.
  • Deciding how to access remote data from web services, including how to reliably retrieve data and how to cache data.
  • Deciding how to unit test the application.

The Enterprise Application Patterns using Xamarin.Forms eBook addresses these issues and provides guidance on building cross-platform enterprise applications using Xamarin.Forms. It's aimed at readers who are already familiar with Xamarin.Forms, and is complementary to .NET Microservices: Architecture for Containerized .NET Applications, which focuses on developing and deploying containerized microservices.

The guide also comes with source code for the eShopOnContainers sample application, which is a cross-platform enterprise application developed using Xamarin.Forms. The following screenshots show the different pages in the eShopOnContainers mobile application:

The mobile application consumes containerized backend microservices that are implemented using ASP.NET Core MVC, and are deployed as unique containers within a single Docker host. The mobile application communicates with the backend services through a REST web interface. However, it can be configured to consume data from mock services for those who wish to avoid deploying the backend services. In addition, unit tests are provided for some of the classes in the app.


This project has a community site, on which you can post questions, and provide feedback. The community site is located on GitHub. Alternatively, feedback about the eBook can be emailed to dotnet-architecture-ebooks-feedback@service.microsoft.com.

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.