@page "/" @using EFCore7Study.DataService; @using EFCore7Study.DataService.Models; @using Microsoft.EntityFrameworkCore; @inject IDbContextFactory DbFactory Index @foreach(var account in AccountList) {

@(account.Name)

}

Hello, world!

Welcome to your new app. @code{ private List AccountList { get; set; } = new List(); protected override void OnInitialized() { AccountList = GetAccounts(); base.OnInitialized(); } private List GetAccounts() { using (var context = DbFactory.CreateDbContext()) { return context.Accounts.ToList(); }; } }