You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -33,11 +33,11 @@ For more information about REST, see [API design](/azure/architecture/best-pract
33
33
34
34
## Consuming RESTful APIs
35
35
36
-
The eShopOnContainers multi-platform app uses the Model-View-ViewModel (MVVM) pattern, and the model elements of the pattern represent the domain entities used in the app. The controller and repository classes in the eShopOnContainers reference application accept and return many of these model objects. Therefore, they are used as data transfer objects (DTOs) that hold all the data that is passed between the app and the containerized microservices. The main benefit of using DTOs to pass data to and receive data from a web service is that by transmitting more data in a single remote call, the app can reduce the number of remote calls that need to be made.
36
+
The eShop multi-platform app uses the Model-View-ViewModel (MVVM) pattern, and the model elements of the pattern represent the domain entities used in the app. The controller and repository classes in the eShop reference application accept and return many of these model objects. Therefore, they are used as data transfer objects (DTOs) that hold all the data that is passed between the app and the containerized microservices. The main benefit of using DTOs to pass data to and receive data from a web service is that by transmitting more data in a single remote call, the app can reduce the number of remote calls that need to be made.
37
37
38
38
## Making web requests
39
39
40
-
The eShopOnContainers multi-platform app uses the `HttpClient` class to make requests over HTTP, with JSON being used as the media type. This class provides functionality for asynchronously sending HTTP requests and receiving HTTP responses from a URI identified resource. The HttpResponseMessage class represents an HTTP response message received from a REST API after an HTTP request has been made. It contains information about the response, including the status code, headers, and any body. The HttpContent class represents the HTTP body and content headers, such as Content-Type and Content-Encoding. The content can be read using any of the `ReadAs` methods, such as `ReadAsStringAsync` and `ReadAsByteArrayAsync`, depending on the format of the data.
40
+
The eShop multi-platform app uses the `HttpClient` class to make requests over HTTP, with JSON being used as the media type. This class provides functionality for asynchronously sending HTTP requests and receiving HTTP responses from a URI identified resource. The HttpResponseMessage class represents an HTTP response message received from a REST API after an HTTP request has been made. It contains information about the response, including the status code, headers, and any body. The HttpContent class represents the HTTP body and content headers, such as Content-Type and Content-Encoding. The content can be read using any of the `ReadAs` methods, such as `ReadAsStringAsync` and `ReadAsByteArrayAsync`, depending on the format of the data.
41
41
42
42
## Making a GET request
43
43
@@ -291,12 +291,12 @@ The most common form of caching is read-through caching, where an app retrieves
291
291
292
292
This data can be added to the cache on demand the first time it is retrieved by an app. This means that the app needs to fetch the data only once from the data store, and that subsequent access can be satisfied by using the cache.
293
293
294
-
Distributed applications, such as the eShopOnContainers reference application, should provide either or both of the following caches:
294
+
Distributed applications, such as the eShop reference application, should provide either or both of the following caches:
295
295
296
296
- A shared cache, which can be accessed by multiple processes or machines.
297
297
- A private cache, where data is held locally on the device running the app.
298
298
299
-
The eShopOnContainers multi-platform app uses a private cache, where data is held locally on the device that's running an instance of the app. For information about the cache used by the eShopOnContainers reference application, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
299
+
The eShop multi-platform app uses a private cache, where data is held locally on the device that's running an instance of the app. For information about the cache used by the eShop reference application, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
300
300
301
301
> [!TIP]
302
302
> Think of the cache as a transient data store that could disappear at any time.
@@ -318,7 +318,7 @@ It's also possible that a cache might fill up if data is allowed to remain for t
318
318
319
319
## Caching images
320
320
321
-
The eShopOnContainers multi-platform app consumes remote product images that benefit from being cached. These images are displayed by the Image control. The .NET MAUI Image control supports caching of downloaded images which has caching enabled by default, and will store the image locally for 24 hours. In addition, the expiration time can be configured with the CacheValidity property. For more information, see [Downloaded Image Caching](/dotnet/maui/user-interface/controls/image#image-caching) on the Microsoft Developer Center.
321
+
The eShop multi-platform app consumes remote product images that benefit from being cached. These images are displayed by the Image control. The .NET MAUI Image control supports caching of downloaded images which has caching enabled by default, and will store the image locally for 24 hours. In addition, the expiration time can be configured with the CacheValidity property. For more information, see [Downloaded Image Caching](/dotnet/maui/user-interface/controls/image#image-caching) on the Microsoft Developer Center.
322
322
323
323
## Increasing resilience
324
324
@@ -352,7 +352,7 @@ If a request still fails after a number of retries, it's better for the app to p
352
352
353
353
Use a finite number of retries, or implement the [Circuit Breaker](/azure/architecture/patterns/circuit-breaker) pattern to allow a service to recover.
354
354
355
-
The eShopOnContainers reference application does implement the retry pattern. For more information, including a discussion of how to combine the retry pattern with the HttpClient class, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
355
+
The eShop reference application does implement the retry pattern. For more information, including a discussion of how to combine the retry pattern with the HttpClient class, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
356
356
357
357
For more information about the retry pattern, see the [Retry](/azure/architecture/patterns/retry) pattern on Microsoft Docs.
358
358
@@ -367,7 +367,7 @@ The circuit breaker pattern can prevent an app from repeatedly trying to execute
367
367
368
368
A circuit breaker acts as a proxy for operations that might fail. The proxy should monitor the number of recent failures that have occurred, and use this information to decide whether to allow the operation to proceed, or to return an exception immediately.
369
369
370
-
The eShopOnContainers multi-platform app does not currently implement the circuit breaker pattern. However, the eShopOnContainers does. For more information, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
370
+
The eShop multi-platform app does not currently implement the circuit breaker pattern. However, the eShop does. For more information, see [.NET Microservices: Architecture for Containerized .NET Applications](https://aka.ms/microservicesebook).
@@ -18,10 +18,10 @@ User settings are the customizable settings of an app that affect the app's beha
18
18
19
19
## Creating a Settings Interface
20
20
21
-
While the preferences manager can be used directly in your application, it does come with the drawback of making your application tightly coupled to the preferences manager implementation. This coupling means that creating unit tests or extending the functionality of preferences management will be limited since your application will not have a direct way to intercept the behavior. To address this concern, an interface can be created to work as a proxy for preferences management. The interface will allow us to supply an implementation that fits our needs. For example, when writing a unit test, we may want to set specific settings, and the interface will give us an easy way to consistently set this data for the test. The following code example shows the `ISettingsService` interface in the eShopOnContainers multi-platform app:
21
+
While the preferences manager can be used directly in your application, it does come with the drawback of making your application tightly coupled to the preferences manager implementation. This coupling means that creating unit tests or extending the functionality of preferences management will be limited since your application will not have a direct way to intercept the behavior. To address this concern, an interface can be created to work as a proxy for preferences management. The interface will allow us to supply an implementation that fits our needs. For example, when writing a unit test, we may want to set specific settings, and the interface will give us an easy way to consistently set this data for the test. The following code example shows the `ISettingsService` interface in the eShop multi-platform app:
22
22
23
23
```csharp
24
-
namespaceeShopOnContainers.Services.Settings;
24
+
namespaceeShop.Services.Settings;
25
25
26
26
publicinterfaceISettingsService
27
27
{
@@ -45,13 +45,13 @@ public interface ISettingsService
45
45
> [!TIP]
46
46
> Preferences is meant for storing relatively small data. If you need to store larger or more complex data, consider using a local database or filesystem to store the data.
47
47
48
-
Our application will use the `Preferences` class need to implement the `ISettingsService` interface. The code below shows how the eShopOnContainers multi-platform app's `SettingsService` implements the `AuthTokenAccess` and `UseMocks` properties:
48
+
Our application will use the `Preferences` class need to implement the `ISettingsService` interface. The code below shows how the eShop multi-platform app's `SettingsService` implements the `AuthTokenAccess` and `UseMocks` properties:
@@ -74,9 +74,9 @@ Each setting consists of a private key, a private default value, and a public pr
74
74
75
75
## Data binding to user settings
76
76
77
-
In the eShopOnContainers multi-platform app, the `SettingsView` exposes multiple settings the user can configure at runtime. These settings include allowing configuration of whether the app should retrieve data from microservices deployed as Docker containers or whether the app should retrieve data from mock services that don't require an internet connection. When retrieving data from containerized microservices, a base endpoint URL for the microservices must be specified. The image below shows the SettingsView when the user has chosen to retrieve data from containerized microservices.
77
+
In the eShop multi-platform app, the `SettingsView` exposes multiple settings the user can configure at runtime. These settings include allowing configuration of whether the app should retrieve data from microservices deployed as Docker containers or whether the app should retrieve data from mock services that don't require an internet connection. When retrieving data from containerized microservices, a base endpoint URL for the microservices must be specified. The image below shows the SettingsView when the user has chosen to retrieve data from containerized microservices.
78
78
79
-

79
+

80
80
81
81
Data binding can be used to retrieve and set settings exposed by the `ISettingService` interface. This is achieved by controls on the view binding to view model properties that in turn access properties in the `ISettingService` interface and raising a property changed notification if the value has changed.
0 commit comments