It is amazing!
I’ll leave that previous post just in case anyone ever needs to create an ECO object instance first and then connect it with an EcoSpace afterwards, but you don’t need it for MonoRail!
public void Join([EcoDataBind("User")]User user)
PropertyBag["User"] = user;
if (this.Params["User.FirstName"] != null)
if (Context.Params["ConfirmEmailAddress"] != user.EmailAddress)
Errors.Add("Email address confirmation does not match email address.");
if (Errors.Count == 0)
That’s all there is to it now! I have created a small set of classes to enable ECO support in MonoRail. Instead of descending your controllers from
SmartDispatcherController you will now descend from
EcoSmartDispatcherController. This gives the following abilities:
- The EcoSpace instance is created automatically for each request.
- If the EcoSpace is dirty at the end of the request it is serialized and stored in the Session. Next request it is deserialized from the Session instead of being created new.
- You can use the [EcoDataBinder] attribute as displayed above. This will ensure that the object instance of the parameter type is created within the EcoSpace of the controller. No need to modify your business classes at all. Form data is automatically bound to the object, and when posted the binding is automatically reversed.
- You can add the ExternalId to your form as a hidden input like so
I really hope I don’t find an insurpassable obstacle with this framework, because I can really see myself liking it!