Services

We have also written a number of services to help with various tasks. These are all located in Internal\Services. If you need any of these services, simply inject their interfaces or classes.

Caching Services

There are three flavors of caching services: memory, session and local storage. They are both implemented as different interfaces: IMemoryCacheService, ISessionCacheService andIStorageCacheService respectively. The difference between the three is as follows:

  • The memory cache should only be used when it is not possible to use the other two. Both session storage and local storage require the Javascript runtimg (IJSRuntime) to be available. This may not always be the case.
  • The session cache should be used when you expect the cache items to only live as long as the Blazor session lives.
  • The storage cached should be used for longer lived caching needs. Under the hood it uses the browser's local storage.

AppStateService

This is designed to be a "global" service that can be used state between pages and components. Please do not abuse this concept. If you can, use component capabilities to share state between parent and child components. Beware that this service is not truly global. It is registered as a scoped Blazor service. For more information on Blazor scoping, read Microsoft's documentation.

FileSaverService

This service allows you to download files to the browser. Please see the code for documentation.

Table of Contents



An error has occurred. This application may no longer respond until reloaded. Reload 🗙