I removed the hard-coded dependency on ActiveRecord from my marshaling code. I’m now using this marker module to flag that an object supports data binding:
module RubyClr
module Bindable
def get_binding_context
raise NotImplementedError("...")
end
end
endTo make a class data bindable you just have to mix in this module and implement get_binding_context. Here’s how I patch ActiveRecord:
class ActiveRecord::Base include RubyClr::Bindable def get_binding_context @attributes end end
I also massively refactored the CLR shadow class generation code in RubyCLR to support two-way data binding. I also checked some unit tests to verify this behavior into the trunk.
Next up is implementing the data binding notification interfaces required to get a real editing experience in data bound controls.