Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created August 28, 2015 05:31
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/335559b43d4ac06ef151 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/335559b43d4ac06ef151 to your computer and use it in GitHub Desktop.
static void CreateStudent()
{
Student s = new Student
{
Id = 1,
Age = 12,
Name = "Foo"
};
StudentAddress sa1 = new StudentAddress { Address = "Delhi", Id = 1 };
StudentAddress sa2 = new StudentAddress { Address = "Bangalore", Id = 2 };
s.StudentAddresses.Add(sa1);
s.StudentAddresses.Add(sa2);
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