whenever i enter and submit my form empty it doesent come off as null it just recieve it as a " " blank space. this is also one of the reason my validation is not working thus i get empty values in my database
@page "/database"@rendermode InteractiveAuto@*Form*@<div class="row"><div class="col-12"><div class="card"><div class="card-body"><h1 class="card-title text-center">DataBase Insert</h1><EditForm Model="employee" OnSubmit="Submit" FormName="Person"><DataAnnotationsValidator/><ValidationSummary class="text-danger" role="alert" /><label>Name: </label><InputText placeholder="Name" class="form-control" @bind-Value="employee!.Name" aria-required="true" /><ValidationMessage For="@(() => employee.Name)" class="text-danger" /><br /><label>Age: </label><InputNumber placeholder="Age" class="form-control" @bind-Value="employee!.Age" aria-required="true" /><ValidationMessage For="@(() => employee.Age)" class="text-danger" /><br /><label>Address: </label><InputText placeholder="Address" class="form-control" @bind-Value="employee!.HomeAddress" aria-required="true" /><ValidationMessage For="@(() => employee.HomeAddress)" class="text-danger" /><br /><label>WhereFrom: </label><InputText placeholder="WhereFrom?" class="form-control" @bind-Value="employee!.WhereFrom" aria-required="true" /><ValidationMessage For="@(() => employee.WhereFrom)" class="text-danger" /><br /><button type="submit" class="btn btn-primary btn-rounded">Submit</button></EditForm></div></div></div></div>@*Database*@<div class="row"><div class="col-12"><div class="card"><div class="card-body"><h1 class="card-title text-center">DataBase Table</h1> @*Table*@<table class="table table-bordered text-center"><tr class="bg-dark text-white"><td> ID </td><td> Name </td><td> Age </td><td> HomeAddress </td><td> WhereFrom </td><td></td></tr><tr> @foreach (var employees in employeeList) {<tr><td>@employees.Id</td><td>@employees.Name</td><td>@employees.Age</td><td>@employees.HomeAddress</td><td>@employees.WhereFrom</td><td><button type="submit" class="btn btn-danger" @onclick="Delete" href="database">X</button></td></tr> }</tr></table></div></div></div></div>@inject ILogger<Home> Logger@inject Data.AppDbContext dbContext@inject Data.AppDbContext Context@code { [SupplyParameterFromForm] public Employee? employee { get; set; } public List<Employee> employeeList = new List<Employee>(); protected override void OnInitialized() { employee ??= new(); } protected async void Delete() { dbContext._Employee.Remove(employee); await dbContext.SaveChangesAsync(); } private async Task Submit() { dbContext._Employee.Add(employee); await dbContext.SaveChangesAsync(); }}Here is my Employee Model Code
using System.ComponentModel.DataAnnotations;namespace BlazorTestApp6.Models{ public class Employee { [Key] public int Id { get; set; } [Required(ErrorMessage = "Name is required must not be empty")] public string Name { get; set; } = null!; [Required(ErrorMessage = "Age is required must not be empty")] public int Age { get; set; } [Required(ErrorMessage = "Home Address is required must not be empty")] public string HomeAddress { get; set; } = null!; [Required(ErrorMessage = "Where are you from without the info we wont know where you are from")] public string WhereFrom { get; set; } = null!; }}I want this to come null when empty for the validation to work