I’m creating an application for a client in Blazor using APIs. I have forms with many textareas for notes.
The class for the database is defined like this:
[JsonPropertyName("smokequestion1")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SmokeQuestion1 { get; set; }
[JsonPropertyName("smokequestion2")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SmokeQuestion2 { get; set; }
[JsonPropertyName("smokequestion3")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? SmokeQuestion3 { get; set; }
I was wondering if there is a better approach to saving this data in the database. In this case, for each textarea in the form I have a related column in the database. So, I can read and save the data in the database.
Obviously, this approach forces me to have a lot of columns in the database that are or aren’t use but they take space.
Is there any other approach I can use in order to improve how I save the notes in the database?
3