Created
August 28, 2015 05:31
-
-
Save debugmodedotnet/335559b43d4ac06ef151 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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