updating is usually done with a primary key and in your case the customer-id is what you will need for updates. if you have the lastname in the where clause, there are still chances of updating multiple records if you have many customers with the same last name.When Add Object() is called, a temporary Entity Key is generated and the Entity State is set to 'Added', as shown below: When context.Save Changes() is called, EF 4.0 goes ahead and inserts the record into the database.
Now there are three ways to add a new object to the object context: 1. We then add this instance to the Customers set using the Entity Set. The Add Object() method is used for adding newly created objects that do not exist in the database.In any case, entities and context classes will look similar.Here, we will see how to update a single Student entity (not entity graph). In this way, we can easily update a single entity using DBContext in the disconnected mode. Entry method returns an instance of DBEntity Entry for a specified Entity.In the next chapter you will learn how to delete a single entity in the disconnected mode. Now you can ask questions directly to me on my new site ASPForums.