Diener nicht in der Lage, den Typ' Microsoft.EntityFrameworkcore.dbset`1 [toDoapidb.models.todoItem] '
während zu aktivieren, um' todoapidb.data. /todoapidb.data zu aktivieren ''. /> < /blockquote>
Code: Select all
Program.cs
Code: Select all
builder.Services.AddScoped();
< /code>
ITodoItemsService.cs
Code: Select all
public interface ITodoItemsService
{
List? GetAbunch(string[] myAnimals);
}
< /code>
TodoItemsService.cs
public class TodoItemsService: ITodoItemsService
{
private readonly DbSet _todoItems;
public TodoItemsService(DbSet todoItems)
{
_todoItems = todoItems;
}
List? ITodoItemsService.GetAbunch(string[] myAnimals)
{
var animals = _todoItems.Where(i => myAnimals.Contains(i.Name))
.ToList();
return animals;
}
}
< /code>
GitHub code of the API application.
Screenshot of the error in Visual Studio:
