예제 #1
0
        static void Main(string[] args)
        {
            using (var db = new CarModelContainer())
            {
                Person persona = new Person();
                persona.FirstName = "Antonio";
                persona.LastName = "Pelleriti";
                db.PersonSet.Add(persona);
                db.SaveChanges();

                Car car1 = new Car();
                car1.Targa = "AB123CD";
                car1.Modello = "Alfa Romeo GT";
                car1.Person = persona;
                db.CarSet.Add(car1);
                db.SaveChanges();
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            using (var db = new CarModelContainer())
            {
                Person persona = new Person();
                persona.FirstName = "Antonio";
                persona.LastName  = "Pelleriti";
                db.PersonSet.Add(persona);
                db.SaveChanges();

                Car car1 = new Car();
                car1.Targa   = "AB123CD";
                car1.Modello = "Alfa Romeo GT";
                car1.Person  = persona;
                db.CarSet.Add(car1);
                db.SaveChanges();
            }
        }