The mapName issue sounds like a config error. Unless you are using Multi-provider mode and MetadataMaps, then check that the mapName is "esDefault":
providerMetadataKey="esDefault"
As to binding, I was able to duplicate the issue using our test db, a DataGridView (no 3rd party control), and an entity bound to a BindingSource. Unfortunately, the behavior is so bizarre, I do not have a better work-around for you than the one you've already come up with.
First, I took the custom entity code from your original post (8244), and put it in my custom CustomerGroup entity class.
I added this variable to my Form1 class:
Code:
Dim custGroup As New CustomerGroup()
Here is my Form1_Load:
Code:
Dim cgq As New CustomerGroupQuery("cg")
Dim gq As New GroupQuery("g")
cgq.Select(cgq)
cgq.Select(gq.Notes.As("CustomerNote"))
cgq.InnerJoin(gq).On(cgq.GroupID = gq.Id)
cgq.Where(cgq.GroupID.Equal("10001"))
custGroup.Load(cgq)
BindingSource1.DataSource = custGroup
DataGridView1.DataSource = BindingSource1
I kept ButtonSave_Click very simple:
Code:
DataGridView1.EndEdit()
BindingSource1.EndEdit()
Console.WriteLine(custGroup.CustomerNote)
Strange behavior #1: As you pointed out, when the form loads, the CustomerNote contains "Some notes" from the database. When I change it to "Note one", and click the Save button it reverts back to the old value. Stepping through SetColumn in the Property, I see the Row value change, but the instant I step out of the settor, it reverts back to its old value.
Strange behavior #2: My Save does not have a Me.Close(), so I typed "Note two", clicked the Save button, and this time it stuck. All subsequent changes were retained. When I closed the Form and re-opened it, the first change got lost, but all the rest were OK.
Strange behavior #3: If I change the object to a collection:
Dim custGroup As New CustomerGroupcollection()
and this line in the Save:
Console.WriteLine(custGroup(0).CustomerNote)
and leave everything else the same. Then the change works the first time, and every time thereafter, no problems.
I tried some variations, eliminating the BindingSource, calling custGroup.EndEdit(), etc. Nothing helped. I was also able to duplicate this in our C# test app, so it is not a C# vs. VB thing. All I can say at this point is that we are still working on it.
David Neal Parsons
www.entityspaces.net