Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created August 27, 2015 19:34
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/14c0d15521073af1c895 to your computer and use it in GitHub Desktop.
Save debugmodedotnet/14c0d15521073af1c895 to your computer and use it in GitHub Desktop.
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