@typeparam TTaxonomy where TTaxonomy : BaseTaxonomyModel
@code {
[Parameter] public required BaseDatabaseService DataService { get; set; }
[Parameter] public required ICollection? Values { get; set; }
[Parameter] public EventCallback> ValuesChanged { get; set; }
ICollection _entities = new List();
protected override async Task OnInitializedAsync()
{
_entities = await DataService.AsNoTracking().GetAsync();
}
async Task Add(string name)
{
var taxonomy = (TTaxonomy?)Activator.CreateInstance(typeof(TTaxonomy));
if (taxonomy == null)
throw new InvalidOperationException($"Could not create instance of type {nameof(TTaxonomy)}");
taxonomy.Name = name;
taxonomy = await DataService.AddAsync(taxonomy);
return taxonomy;
}
}