EFCore7Study/EFCore7Study.WebApi/Controllers/EFCore3Controller.cs

61 lines
1.5 KiB
C#

using EFCore7Study.DataService;
using EFCore7Study.DataService.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Internal;
namespace EFCore7Study.WebApi.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class EFCore3Controller : ControllerBase
{
private readonly IDbContextFactory<AppDbContext3> _contextFactory;
public EFCore3Controller(IDbContextFactory<AppDbContext3> contextFactory)
{
_contextFactory = contextFactory;
}
[HttpGet]
public List<Account> GetAll()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
[HttpGet]
public List<Account> GetAll2()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
[HttpGet]
public List<Account> GetAll3()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
[HttpGet]
public List<Account> GetAll4()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
[HttpGet]
public List<Account> GetAll5()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
[HttpGet]
public List<Account> GetAll6()
{
return _contextFactory.CreateDbContext().Accounts.ToList();
}
}
}