Exemplo n.º 1
0
        private static void AddPeople()
        {
            var mapper = new PersonMapper();

            for (var i = 0; i < 5; i++)
            {
                var birthYear = DateTime.Now.Year - ((i + 1) * 10);

                var person = new Person
                {
                    FirstName   = string.Format("Nome {0}", i),
                    LastName    = string.Format("Cognome {0}", i),
                    Age         = (i + 1) * 10,
                    DateOfBirth = new DateTime(birthYear, DateTime.Now.Month, DateTime.Now.Day)
                };
                mapper.Insert(person);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            try
            {
                System.Console.WriteLine("1...");

                var personMapper = new PersonMapper();

                //AddPeople();

                var people = personMapper.Query();
                foreach (var person in people)
                {
                    System.Console.WriteLine(person.ToString());
                }

                System.Console.WriteLine("2...");

                var carMapper = new CarMapper();

                //AddCars();

                foreach (var car in carMapper.Query())
                {
                    Console.WriteLine(car.ToString());
                }

                System.Console.WriteLine("Fine...");
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format("{0} - {1}", ex.Message, ex.StackTrace));
            }

            System.Console.ReadLine();
        }