End Google Ads 201810 - BS.net 01 --> Hello,

I realize that, DatabaseContext class generated by LINQ to SQL / LINQ to ENTITY should not be a part of the Views and so I want to encapsulate the uses of DatabaseContext classes within my Data Access Layer. So, when I need to display a set of records in a GridView in Windows Form, I can simply let my Data Access Layer return the List of the records and display that records in GridView without any problem. Great!

Here is my Person class

public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}Ok, now, I face the big problem when I need to save the changes back to the database. I may have 1000 records displaying in the Grid view where the GridView is bound to a BindingSource. My user can change only 2-3 records from the GridView and delete some of the records as well. How can I tell the LINQ to SQL / LINQ to Entity (data context) about the changed records so that when I pass the List object to my Data Access Layer, Data Access Layer can identify which records needs to be updated and finally the Data Context updates those records ?

Can you please show me some pattern for this problem ?

Regards.