using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using ModelsLib; using System; using System.Collections.Generic; using System.Text; public class DesireService { private readonly IDbContextFactory _factory; private readonly IWebHostEnvironment _env; public DesireService(IDbContextFactory factory, IWebHostEnvironment env) { _factory = factory; _env = env; } public List GetDEsireShooting() { using var db = _factory.CreateDbContext(); return db.DesireDb.Select(ds => ds.Desire).ToList(); } }