Exemplo n.º 1
0
        protected override void Seed(CyclingDbContextSQLite context)
        {
            var destination = new CyclingDestination();

            destination.Name    = "Somewhere in Pirin";
            destination.Country = "Bulgaria";

            var instructor = new CyclingInstructor();

            instructor.Name    = "Nikodim Nikodimov";
            instructor.Country = "Bulgaria";

            context.Set <CyclingDestination>().Add(destination);
            context.Set <CyclingInstructor>().Add(instructor);
        }
        protected void ButtonFillSQLite_Click(object sender, EventArgs e)
        {
            var destination = new CyclingDestination();

            destination.Name    = "Somewhere in Pirin";
            destination.Country = "Bulgaria";

            var instructor = new CyclingInstructor();

            instructor.Name    = "Nikodim Nikodimov";
            instructor.Country = "Bulgaria";

            using (var unitOfWork = new EfUnitOfWork(new CyclingDbContextSQLite()))
            {
                unitOfWork.CyclingDestinationsRepository.Add(destination);
                unitOfWork.CyclingInstructorsRepository.Add(instructor);

                unitOfWork.Commit();
            }
        }