public static void Main(string[] args) { TinyIoCContainer container = new(); container.Register <IDbRepository, DbRepository>().AsSingleton(); var repo = container.Resolve <IDbRepository>(); using var db = new ForestContext(); db.Database.EnsureDeleted(); db.Database.EnsureCreated(); var book = new DbKeyValue() { Value = "foo" }; db.Add(book); db.SaveChanges(); var books = db.KeyValues !.ToList(); }
public IEnumerable <Breed> GetUndergrowthBreeds([FromUri] int all = 0) { using (var _context = new ForestContext()) return(_context.Breeds.Where(b => b.Code > 400000 && (all == 1 || b.Code % 100 == 0)).ToList()); }
public IEnumerable <GroundCover> GetGroundCoverKinds() { using (var _context = new ForestContext()) return(_context.GroundCovers.ToList()); }
public IEnumerable <Region> GetRegions() { using (var _context = new ForestContext()) return(_context.Regions.ToList()); }
public IEnumerable <ForestryProductionAssociation> GetForestryProductionAssociations() { using (var _context = new ForestContext()) return(_context.ForestryProductionAssociations.Where(x => x.RegionCode != null).ToList()); }
public IEnumerable <Forestry> GetForestries() { using (var _context = new ForestContext()) return(_context.Forestries.Where(x => x.ForestFarmCode != null).ToList()); }