Пример #1
0
        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();
        }
Пример #2
0
 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());
 }
Пример #3
0
 public IEnumerable <GroundCover> GetGroundCoverKinds()
 {
     using (var _context = new ForestContext())
         return(_context.GroundCovers.ToList());
 }
Пример #4
0
 public IEnumerable <Region> GetRegions()
 {
     using (var _context = new ForestContext())
         return(_context.Regions.ToList());
 }
Пример #5
0
 public IEnumerable <ForestryProductionAssociation> GetForestryProductionAssociations()
 {
     using (var _context = new ForestContext())
         return(_context.ForestryProductionAssociations.Where(x => x.RegionCode != null).ToList());
 }
Пример #6
0
 public IEnumerable <Forestry> GetForestries()
 {
     using (var _context = new ForestContext())
         return(_context.Forestries.Where(x => x.ForestFarmCode != null).ToList());
 }