I am following the philosophy of writing a "dumb UI". What do I mean by that? I mean that I'm using the CSLADataSource, and doing using DataBinding all over the place. I am using my Business Objects to validate my data. I am taking the "hit" validating ONLY at the business object level, to reduce the maintenance/cost of ownership of the UI. My UI will be used by a power-user.
Given that, I am attempting to write a FormView control to edit a CSLA Business Object. My formview has nothing but the binding expressions, textboxes, labels and minimalist HTML. I am binding my BrokenRules collection to a DataList Control and handling validation in that way. I am not doing any ASP.NET Validation controls, and would be happy to avoid "double duty" validation, in favor of reducing maintenance/code.
Ran into a problem because I am using the DataMapper to map my form to the CSLA Object. The DataMapper chokes on a field defined as an Int32, because it should be a required field in the UI. I'd like to get the data into Business Object to be validated. If I could, I could at a minimum, write a custom rule.
I was thinking that the datamapper should see string.empty coming in for an property defined as Int32, and default it to 0. Right now, I am thinking I need to run all my e.Values that map to "Int32" fields, and filter them, shoving zero in, before I hand it off to the DataMapper.
-Tom
Discussed this with another developer, who made a good point. The DataMapper is targeted mostly for the web service proxy stuff. I had seen it used in the webform sample.
My options are to simply wrap it, as suggested by my peer. Alternately, I could just not use the DataMapper. Its targeted for mapping A to B, not validating data, etc.
Copyright (c) Marimer LLC