Created
August 28, 2015 07:39
-
-
Save debugmodedotnet/ed02616b7ab91df06d52 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" | |
}; | |
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