The Helpers app, as previously covered in posts here, has been extended to include a Members table. This includes uploading new members from a Csv file as well as for updating existing members, using Entity Framework Core.

The Original App Functionality

I have previously developed Blazor apps for my Athletics club such as a QR Code Gate contact tracing app and a Gym Bookings app. The club is required to provide helpers, apart from officials for various supplementary duties on the days of summer interclub and winter cross country competition as well as for various state championship competitions. A Blazor Server (only) app was developed for Helpers to volunteer for tasks. Prior to this app, things were handled with a paper list of tasks, email and SMS messages and a phone. A lot of work for one person. It was decided that it would be better to have a web site where members and others can volunteer coupled with as Y/N SMS confirmations mechanism much like medical and other appointments. This was successfully implemented last summer and has had a great reception from club members and volunteers. Indeed, other clubs on hearing about it have asked, “Where do we sign?”.

Members Database

We now have added a members’ database to the app so as to be able send targeted emails to subgroups of the members determined from database queries based mainly upon group membership. The members are imported from a CSV list of registered members as supplied from the sport’s association. Annual registrations are due from April 1 each year. Winter competitors generally register in April/May whereas track-only competitors generally register in September/October. Sparodic registrations occur at other times. So there is a need to import and update an updated CSV list a numbers of at various times during the year. There is also a need to manually add members who are associated with the club but not registered with the association, as well as a requirement for member properties that need to manually entered for individual members that are club specific such as **“Is a Club Committee Member”, etc. There is also a need to automatically create age based team groups for communications.

A required feature of the Members table is that a CSV upload and parsing of a member’s data should be consistent. If a member does not exist in the database then it gets added. If it already exists then the CSV data should only do an update. Also manually entered group memberships such as Committee (see IsCustom property in the next blog post) should remain unchanged with updates. The upload should be idempotent: A repeat of the same CSV file upload should result in no changes to the database.


The CSV file that is supplied by the association has field names as a CSV list as the first line, followed by one line per member as a CSV list of those properties for the member. An initial table was created in SQL Server by loading the CSV file into an Excel Sheet and importing that into Azure SQL Thus Database-First rather than Code-First was used to create the Member Entity class using Entity Framework Core. This class was refined and then pushed back out to the database as a new table using Entity Framework Code-First. Code was then developed to read the CSV members text file, split it into lines then split lines using the comma delimiter and interpret it in terms of the Member class.

The CSV file is pasted into an TextArea in the Razor Add-Members page. It is checked and then sent to the server for processing. As feedback to the (Admin) user, during this process a progressive count is kept of:

  • Added New Members
  • Updated Members
  • Failed Additions
  • Failed Updates,

There is actually two TextAreas on that Razor page. The Columns TextArea already has as a Header, all of the database writeable field names as a CSV list. The user can than paste the CSV values as text into the second TextBox without the Header. Alternatively, they can paste the Header plus Member values as one in the first TextArea. Each member line is sent separately to the server with the Header as a string array of 2 strings. This enables the continuous feedback as above as the processing proceeds. Checks are made prior to submission to check that the header and line of values are both not empty.

On the server side, the key C# code for splitting a line that is a textual CSV list into it an array of string values is:

    string[] values = line.Split(',');

There is some nuancing of this in the next blog post in this series.


The functionality was extended to seamlessly allow lines of Tab Separated Values(TSV) to be submitted. The header and value lines can both be separately be either CSV or TSV. TSV would simplify the double quoted values, but no code changes are required on that front for TSV. The C# code for the splitting into the values array for TSV is:

    string[] values = line.Split('\t');

<  Prev:   Jekyll
 This Category Links 
Category:Blazor Index:Blazor
  Next: > Blazor Helpers App Members
<  Prev:   Blazor Helpers App