+2008-02-25 Marek Habersack <mhabersack@novell.com>
+
+ * TemplateControlCompiler.cs: GetContainerType now checks whether
+ the binding container returned from the builder implements
+ IDataItemContainer (for 2.0+ profiles) and looks for one more
+ property, Rows, if no Items property is found.
+
2008-02-08 Gert Driesen <drieseng@users.sourceforge.net>
* AppSettingsExpressionBuilder.cs: Improve exception messages. Return
parent.renderMethod.Statements.Add (AddLinePragma (expr, cr));
}
+ static PropertyInfo GetContainerProperty (Type type, string[] propNames)
+ {
+ PropertyInfo prop;
+
+ foreach (string name in propNames) {
+ prop = type.GetProperty (name, noCaseFlags & ~BindingFlags.NonPublic);
+ if (prop != null)
+ return prop;
+ }
+
+ return null;
+ }
+
+ static string[] containerPropNames = {"Items", "Rows"};
+
static Type GetContainerType (ControlBuilder builder)
{
TemplateBuilder tb = builder as TemplateBuilder;
if (tb != null && tb.ContainerType != null)
return tb.ContainerType;
-#if NET_2_0
- return builder.BindingContainerType;
-#else
+
Type type = builder.BindingContainerType;
- PropertyInfo prop = type.GetProperty ("Items", noCaseFlags & ~BindingFlags.NonPublic);
+#if NET_2_0
+ if (typeof (IDataItemContainer).IsAssignableFrom (type))
+ return type;
+#endif
+
+ PropertyInfo prop = GetContainerProperty (type, containerPropNames);
if (prop == null)
return type;
return type;
return prop.PropertyType;
-#endif
}
CodeMemberMethod CreateDBMethod (ControlBuilder builder, string name, Type container, Type target)
+2008-02-25 Marek Habersack <mhabersack@novell.com>
+
+ * ControlBuilder.cs: correctly chain up to the parent builder when
+ looking for the naming container.
+
2008-02-21 Marek Habersack <mhabersack@novell.com>
* ControlBuilder.cs: introduced a new internal property -
if (myNamingContainer == null) {
Type controlType = parentBuilder != null ? parentBuilder.ControlType : null;
- if (controlType == null)
+ if (parentBuilder == null && controlType == null)
myNamingContainer = null;
- else if (typeof (INamingContainer).IsAssignableFrom (controlType))
+ else if (controlType != null && typeof (INamingContainer).IsAssignableFrom (controlType))
myNamingContainer = parentBuilder;
else
myNamingContainer = parentBuilder.MyNamingContainer;
if (cb is ContentBuilderInternal)
return cb.BindingContainerType;
#endif
-
+
return cb.ControlType;
}
}