static void Main(string[] args) { var context = new DatabaseFirstDemoEntities(); var emp = new Employee() { EID = 1, EName = "anusha" }; context.Employees.Add(emp); context.SaveChanges(); }
static void Main(string[] args) { var context = new DatabaseFirstDemoEntities(); var post = new Post() { Body = "Body", DatePublished = DateTime.Now, Title = "Title", PostID = 1 }; context.Posts.Add(post); context.SaveChanges(); }
static void Main(string[] args) { var context = new DatabaseFirstDemoEntities(); var post = new post() { body = "Body", date_published = DateTime.Now, title = "Title", post_id = 1 }; context.posts.Add(post); context.SaveChanges(); }
static void Main(string[] args) { //Uso rápido: var contexto = new DatabaseFirstDemoEntities(); var post = new Post() { Body = "Hello World!", DatePublished = DateTime.UtcNow, Title = "Database Hello World" }; contexto.Post.Add(post); // Aqui é o "Commit". contexto.SaveChanges(); // Aqui é onde realmente é salvo, o "Push". }
static void Main(string[] args) { //Instancia var context = new DatabaseFirstDemoEntities(); //Nuevo Post var post = new Posts() { Body = "Body", DatePublished = DateTime.Now, Title = "Title", PostID = 1 }; //Añadirlo y guardar (esto no guarda en BBDD) context.Posts.Add(post); //Guardar en BBDD context.SaveChanges(); }