5 "Databinding object with non-public constructor"
\r
6 Added ability to create types with non-public constructors. Not sure I like it, but...
\r
8 - Changed DefaultConversion behavior: empty string is now considered
\r
9 a non succeeded conversion. It used to be considered successful returning false.
\r
11 This might be a breaking change!
\r
14 - Applied Brian Chan's patch fixing MR-282
\r
15 "Binding to a nested IList<> or not null nested List<> fails"
\r
17 - Applied Adam Tybor's patch fixing MR-289
\r
18 "Array Binding for Prototype Style Serialization"
\r
20 - Applied Adam Tybor's patch fixing MR-266
\r
21 "Fix for GetErrorSummary() throwing an KeyNotFoundException for SmartDispatch Controller and Binder"
\r
24 "Validators in a Chain - ValidateNonEmpty fails with BelongsTo"
\r
26 - Changed DefaultConverter behavior:
\r
28 -> If we are dealing with a primitive, non-null values will always
\r
29 set conversionSuceeded to true
\r
30 That's because the value was on the form, and the binder needs to set it
\r
32 -> If we are dealing with a nullable, the conversionSuceeded will be set to true
\r
33 if the nested conversion succeeds or if the input is different from null.
\r
35 - Fixed COMP-8: Converter is not able to deal with Nullables<>
\r
37 - Fixed COMP-6: Nullable boolean cannot be bound
\r
39 - Updated to check argument inheritance for conversions.
\r
41 - Resolved COMP-3: Add support for generic collections.
\r
43 - Fixed MR-164: Allow and Exclude property acts on all objects, in any depth.
\r
45 - Applied patch by Lee Henson fixing MR-179
\r
46 "Binder doesn't convert empty strings to null."
\r
48 - Fixed bug that wrongly defined empty strings as conversionSucceeded = false
\r
50 - Fixed COMP-1 "Binder fails on simple MonoRail binding, when using ASP.NET authentication"
\r
51 Now the TreeBuilder will add as a leaf entries starting with '.', or '[' or ']'
\r
53 - Applied patch from Ernst Naezer's fixing a situation where the prefix is composed
\r
54 like "node1.node2.node3"
\r
56 - Removed support for meta elements (as they were passed
\r
57 via get/form and that doesn't look very safe)
\r
59 - More test cases were added
\r
61 - Major refactoring on Graph design and interfaces. However there wasn't any big change
\r
62 on the DataBinder class itself.
\r
64 - Changed ConvertUtils to consider non successful an attempt to convert a null
\r
67 - Added a CanConvert and an additional Convert
\r
69 - Added check for duplicate fields in DataReaderAdapter.
\r
71 - DataReaderAdapter: Added support for TypeConverters
\r
73 - Added two events to IDataBinder:
\r
75 BinderHandler OnBeforeBinding;
\r
76 BinderHandler OnAfterBinding;
\r
78 - Changed to allow null inputs be passed to type converters
\r
80 - Changed ConvertUtils behavior. Now empty strings will be converted to null
\r
81 and conversionSucceeded = true. Also, string will be trimmed.
\r
83 - Introduced DataReaderAdapter which can be used to populate an object based
\r
84 on an IDataReader. The adapter does not take ownership of the reader
\r
88 DataBinder binder = new DataBinder();
\r
90 SqlConnection conn = new SqlConnection("Server=(local);initial catalog=mydatabase;Integrated Security=SSPI");
\r
94 SqlCommand cmd = new SqlCommand("select * from products", conn);
\r
96 using(IDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
\r
98 Product[] products = (Product[])
\r
99 binder.BindObject(typeof(Product[]), "ignored",
\r
100 new DataReaderAdapter(reader));
\r
104 Limitations: only simple properties can be bound. Nested properties are ignored.
\r
107 - IBinderTranslator: after introducing the DataReaderAdapter, it was necessary
\r
108 create the notion of translation. A translator takes the a property name and
\r
109 returns the key that the binder should look up in order to get the value to fill
\r
110 the property. The translator can also return null. In this case the binder will skip
\r
113 A translator is associated with a Binder instance (which I'm not quite sure is a good thing)
\r
117 DataBinder binder = new DataBinder(new ProductTranslator());
\r
119 SqlConnection conn = new SqlConnection("Server=(local);initial catalog=mydatabase;Integrated Security=SSPI");
\r
123 SqlCommand cmd = new SqlCommand("select nome, descricao from produtos", conn);
\r
125 using(IDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
\r
127 Product[] products = (Product[])
\r
128 binder.BindObject(typeof(Product[]), "ignored",
\r
129 new DataReaderAdapter(reader));
\r
134 public class ProductTranslator : IBinderTranslator
\r
136 public String Translate(Type instanceType, String paramName)
\r
138 if (paramName == "Name")
\r
140 return "nome"; // this is the db column name
\r
142 else if (paramName == "Address")
\r
144 return "address"; // this is the db column name
\r
155 - Fix conversion using TypeConverters. The Converter won't be invoked if
\r
158 - The binder was extracted from MonoRail code base.