I have a library function that returns a list of domain objects from a Linq query.
IList<Apple> getApplesByCriteria( ... );
I bind the DataSource property of a DataGridView to the result of this function. Everything works well. Now I want to manipulate properties of Apple. The presentation domain object (UIApple) is different than the original domain object (Apple), where
UIApple map( Apple apple );
converts one to the other.
If I create an intermediate class – UIApple, what do I need to do to persist editing of the DataGridView back to the database? I learned that adding [Browsable(false)] can hide a collumn. However, I’d prefer not to 1) pollute the domain objects with UI concepts; 2) change the auto generated source code.
I created UIApple which is backed by Apple and contains all the manipulation code.
For example:
To persist at the end of editing,