I haven't solved the problem yet, but I may have made some progress.
My collection was based on a view, and I understand that I have to define the primary key in the designer, which I now think I have done, although the check box in the designer could be ambiguous - it says 'Is part of primary key' - It is more than part of the primary key, it IS the primary key.
I also checked the "Is identity" and "Is readonly" checkboxes for field that is my primary key.
The problem now is that the collection that I get, which is then bound to the datagrid binding source, only contains one item, while there should be 6. But if I take the SQL produced by LLBLgen (from the trace), and put it in a SQL Server query, it certainly returns the right number of rows. So LLBLgen is making the correct query, but somehow not filling the collection correctly.
Even though I didn't get the right number of rows I find that I can now edit the Grid, and when I attempt to save, using the code in my first post, I get an exception, and the exception, when looking at the SQL produced, is because it is not picking up the right primary key value. I can verify that the collection contains the right value for the primary key by looking at the collection before it binds to the grid.
Any ideas anyone ?
Below is my code for filling the collection and binding to the datagrid binding source
vendorCosts = new VendorCostCollection();
//Add a Comparison
IPredicateExpression selectFilter = new PredicateExpression();
selectFilter.Add(new FieldCompareValuePredicate(VendorCostFields.ProductId, ComparisonOperator.Equal, productID));
//Add a sorter
SortExpression sorter = new SortExpression(VendorCostFields.Name | SortOperator.Ascending);
//Get collection
vendorCosts.GetMulti(selectFilter, 0, sorter);
vendorCostCollectionBindingSource.DataSource = vendorCosts;