This question is locked. New answers and comments are not allowed.
I'm developing an application which makes use of artificial fields. Artificial fields are added by a user at runtime, so I'm creating and feeding a XML configuration dynamically. It is working well so far but I have a problem when it comes to data binding.
On a windows form, I have a RadGridView, which is supposed to display all the rows in a table that is currently selected by a user, but I don't know how to bind the data to this grid correctly.
According to a post in Ask for A sample about modifying reversemapping.config/app.config, I wrote a custom TypeDescriptionProvider, which is almost exactly the same as the one mentioned in the post.
As this is the case, if I understand correctly, I cannot use ObjectProvider/ObjectView components on VS Form Designer for data-binding purpose. When I use ObjectProvider/ObjectView to bind data, the grid shows empty content, although the table isn't empty actually. When I strip TypeDescriptionProvider attribute from the persistent class, in turn, it works fine except the artificial fields, but it is not a solution at all because I want these artificial fields appear in the grid.
So I'm trying to do data binding on the fly purely by code. OA Documentation suggests something like
It actually shows all the data rows in the grid but, since it expands to a list, the grid complains when you try to edit and/or add rows.
In summary, I need a data binding way that can handle artificial fields correctly. Also it should be created by code at runtime and allow users to modify the rows somehow.
What would the best practice of data binding look like under this situation? Any help would be appreciated.
On a windows form, I have a RadGridView, which is supposed to display all the rows in a table that is currently selected by a user, but I don't know how to bind the data to this grid correctly.
According to a post in Ask for A sample about modifying reversemapping.config/app.config, I wrote a custom TypeDescriptionProvider, which is almost exactly the same as the one mentioned in the post.
As this is the case, if I understand correctly, I cannot use ObjectProvider/ObjectView components on VS Form Designer for data-binding purpose. When I use ObjectProvider/ObjectView to bind data, the grid shows empty content, although the table isn't empty actually. When I strip TypeDescriptionProvider attribute from the persistent class, in turn, it works fine except the artificial fields, but it is not a solution at all because I want these artificial fields appear in the grid.
So I'm trying to do data binding on the fly purely by code. OA Documentation suggests something like
IObjectScope scope = ObjectScopeProvider.ObjectScope(); |
var result = (from c in scope.Extent<MyDataType>() select c).ToList(); |
radGridView.DataSource = result; |
It actually shows all the data rows in the grid but, since it expands to a list, the grid complains when you try to edit and/or add rows.
In summary, I need a data binding way that can handle artificial fields correctly. Also it should be created by code at runtime and allow users to modify the rows somehow.
What would the best practice of data binding look like under this situation? Any help would be appreciated.