I am using Visual Studio 2010, SQL Server 2008 R2 developing on Windows 7 Ultimate. I am using .NET Framework 4 and C# to develop a WinForms application that interfaces to an existing SQL Server database using Entity Framework 5 Code First technique of reverse engineering the DbContext and POCOs from the database and then developing.

My question is how to handle concurrency. So the WinForms GUI implements two-way databinding via this article here[^]. There is a requirement to make the app a WinForms since the customer has security constraints that only permit staff to use their database via a Smart Client and when I got to this client they had already started the WinForms project.

What would really answer this question great are any good links to articles. I have tried to Google search this; however, I am not quite sure I even understand what exactly (terminology-wise etc) I should even be querying Google on.

Basically my question is: Being a newbie to EF Code First, what is the proper handling in order to safely do the following:

1. User adds a new row in edit mode in my grid view, makes some changes and finishes editing.
2. Then user inserts two new records into the table using SQL Server Management Studio (SSMS) by just running a plain old insert query (say this mimics data flowing into the database table from an outside sender whilst we are also viewing the grid view in the WinForms app)
3. Then user does a DbContext.Save Changes() method call on the WinForms app by clicking the Save button.

Two questions:

1) How can I make my Grid View know that an INSERT, UPDATE, or DELETEwas done on the underlying database apart from the application and keep the gridview current?

2) How can i make sure that if records are added to the grid view, then changes happen directly on the database itself and then I go back to the Winforms app and do a save, that my results will be "combined" properly? Right now, some really strange bastard thing happens and I get unpredictable results.

I am going to use the trivial Person example table and POCOs to protect my client's data references. Okay, so my POCO is: