Esempio n. 1
0
        static void ReadData()
        {
            var db         = new SafariContext();
            var allSpecies = db.Safaris.Select(safari => safari.Species);

            foreach (var species in allSpecies)
            {
                Console.WriteLine(species);
            }
Esempio n. 2
0
        static void SeedData()
        {
            var db         = new SafariContext();
            var expedition = new Safari
            {
                Species            = "Jaguar",
                CountOfTimesSeen   = 24,
                LocationOfLastSeen = "Jungle"
            };
            var expedition2 = new Safari
            {
                Species            = "Rhino",
                CountOfTimesSeen   = 30,
                LocationOfLastSeen = "Desert"
            };
            var expedition3 = new Safari
            {
                Species            = "Panther",
                CountOfTimesSeen   = 40,
                LocationOfLastSeen = "Jungle"
            };
            var expedition4 = new Safari
            {
                Species            = "Tiger",
                CountOfTimesSeen   = 60,
                LocationOfLastSeen = "Jungle",
            };
            var expedition5 = new Safari
            {
                Species            = "Elephant",
                CountOfTimesSeen   = 20,
                LocationOfLastSeen = "Desert"
            };

            db.SaveChanges();
        }
Esempio n. 3
0
 static void ReadDataAgain()
 {
     var db = new SafariContext();
 }