我正在尝试在 Blazor 中创建一个“通用列表”组件,并希望该组件能够接受从基类派生的任何对象。我的代码目前如下;
基类:
public class Model
{
// PK for the record
[Key]
public int Id { get; set; }
// holds the front-end name for the record
[Required(ErrorMessage = "Name is required")]
public string Name { get; set; } = "";
// holds the date and time the record was created
[Required(ErrorMessage = "Created Timestamp is required")]
public DateTime Created { get; set; } = DateTime.Now;
// holds the username of the person who created the record
[Required(ErrorMessage …Run Code Online (Sandbox Code Playgroud)