Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created August 28, 2015 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debugmodedotnet/ed02616b7ab91df06d52 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/ed02616b7ab91df06d52 to your computer and use it in GitHub Desktop.
static void CreateStudent()
{
Student s = new Student
{
Id = 1,
Age = 12,
Name = "Foo"
};
Subject s1 = new Subject { Id = 1, Name = "Phy" };
Subject s2 = new Subject { Id = 2, Name = "Maths" };
s.Subjects.Add(s1);
s.Subjects.Add(s2);
Context c = new Context();
c.Students.Add(s);
c.SaveChanges();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment