Created
August 27, 2015 19:34
-
-
Save debugmodedotnet/14c0d15521073af1c895 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
using System; | |
using System.Linq; | |
namespace CodeFirstDemoApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
CreateStudent(); | |
Console.WriteLine("Student Creatred"); | |
Context c = new Context(); | |
var result = from r in c.Students select r; | |
foreach (var r in result) | |
{ | |
Console.WriteLine(r.Name); | |
} | |
Console.ReadKey(true); | |
} | |
static void CreateStudent() | |
{ | |
Student s = new Student | |
{ | |
Id = 1, | |
Age = 12, | |
Name = "Foo" | |
}; | |
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