Can CLR objects be updated from the Grid?
I tacked this question on another on the forum, but I feel it deserves its own topic.
Is it possible to have a two-way binding towards the grid from a CLR object?
Is it possible to have a two-way binding towards the grid from a CLR object?
Comments
vote
1. generate wrappers for your types in DataContextDriver.GetSchemaAndBuildAssembly with MS LINQ to SQL attrubutes Table and Column (or you can create wrappers manually/dynamically or apply this attributes to your original types)
2. create class inherited from LINQPad.DataContextBase, override it method SubmitChanges.
3. In DataContextDriver.InitializeContext (or in user code before dumping) set instance of your DataContext to property Util.CurrentDataContext via reflection.
4. wrap objects in DataContextDriver.DisplayObjectInGrid (or in your user code before dumping, but in this case you must wrap it recursively) and attach to your DataContext . Wrapping is not required when original types with this attributes.
5. Save changes in your DataContext.SubmitChanges
see sample in my driver code
http://dolinqpad.codeplex.com/SourceControl/latest