static void Main(string[] args) { var oBlog = new Blog {BlogId=1,BlogName="Ibrahim Code book",BlogUrl="www.ibrahimcodebook.blogspot.com"}; var oMyContext = new MyContext(); oMyContext.Blogs.Add(oBlog); oMyContext.SaveChanges(); }
static void Main(string[] args) { MyContext context = new MyContext(); Employee emp = new Employee() { EmpID = 1, EmpName = "CAI", Address = "Bangalore", Address1 = "bbbb" }; // context.Entry(emp).Reload(); context.Employees.Add(emp); context.SaveChanges(); }