Search code examples
linq-to-sqlcastle-monoraildatabinder

How to get Castle MonoRail's DataBinder/SmartDispatcherController to bind against types containing properties that are interfaces?


We're using interfaces to represent entity classes in our domain model. We have concrete implementations of these by virtue of using LinqToSql. We have added a factory method to each LinqToSql class which our service layer uses to instantiate a new entity (note; as opposed to the controller's DataBind attribute doing it).

MonoRail's default DataBinder implementation will ignore properties that are defined as interfaces.

Ideally, we don't want to instantiate our data-layer classes in MonoRail - the whole point of the interfaces is to separate these concerns.

Also, we don't really want to create another set of non-LinqToSql concrete classes whose only job is to translate between layers.

It's the end of a really long day over here; please can someone have mercy and point us at the parts of IDataBinder that we should overload with our own implementations, or hint at other approaches we might attempt? ;-)


Solution

  • You should be looking at IParameterBinder. take a look at a post I've written on the subject