How to load data when Blazor server starts (and understanding of singleton)

This page summarizes the projects mentioned and recommended in the original post on /r/Blazor

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Damselfly

    Damselfly is a server-based Photograph Management app. The goal of Damselfly is to index an extremely large collection of images, and allow easy search and retrieval of those images, using metadata such as the IPTC keyword tags, as well as the folder and file names. Damselfly includes support for object/face detection.

  • Entity Framework

    EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • EstEID.Blazor

    Demo of reading Estonian ID card personal data file and using Blazor for UI.

  • If I understand correctly you can have make a class that gets initialized on startup. For singleton the constructor can have a task that wont resolve which isnt ideal but will work. How many queries you make to the database then is your own to implement. For example lets say we use entitiyframework. You can make a permarunning task in a singleton class constructor that will just keep some data in memory. Then that Task calls the savechanges() every one hour. If there is a power outage obviously you will have hour lost of data but thats not the question. That class will get initialized on program startup and will keep running until you shut it down. I did long ago a tool to read data from Smart Cardsthat utilized a singleton class to fire events and then blazor to use as UI. The idea is that since there is ever only 1 instance of that class the events fired will propagate to every subscriber. This way you can have a client to display data, a client to say log info etc. Similar approach can be used to handle data in your case. You can attach several "screens" through browser to make same data be displayed in several locations etc. The public bit i can share as an example is here: https://github.com/elraito/EstEID.Blazor. It is trivial to track when something gets initilized or fires since we do have console.writeline() :)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts