Пример #1
0
 static void Main(string[] args)
 {
     using (var ctx = new StudentContext())
     {
         var student = new Student()
         {
             StudentID       = Guid.NewGuid(),
             FullNames       = "Mary Jane",
             Surname         = "Bond",
             Gender          = "M",
             DateOfBirth     = new DateTime(1980, 1, 1),
             Height          = 5.5M,
             Weight          = 60,
             FeesOutstanding = 0
         };
         ctx.Add(student);
         ctx.SaveChanges();
         Console.Write("Completed");
     }
 }
Пример #2
0
 static void Main(string[] args)
 {
     using (var ctx = new StudentContext())
     {
         var James = new Student()
         {
             FullNames   = "Charles Cunningham",
             DateOfBirth = new DateTime(1970, 1, 1),
             Gender      = "M",
             Surname     = "Bond",
             Height      = 6,
             Weight      = 80
         };
         James.Siblings.Add(new Sibling()
         {
             SiblingID = Guid.NewGuid(), Name = "Anita Bond"
         });
         ctx.Add(James);
         ctx.SaveChanges();
         Console.WriteLine("Done");
     }
 }