private static void SetProperties(XmlNode node, ValueStack.ValueStack stack, object obj) { foreach (XmlAttribute a in node.Attributes) { if (String.IsNullOrEmpty(a.Prefix)) { PropertyInfo prop = obj.GetType() .GetProperty(a.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); if (prop == null) throw new Exception(String.Format("Property '{0}' is not found in type '{1}'", a.Name, obj.GetType().Name)); String aValue = ApplicationContext.Context.DAL.TranslateString(a.Value.Trim()); if (prop.PropertyType == typeof(DataBinder)) { object bindedObject; String propertyName; stack.Evaluate(aValue, out bindedObject, out propertyName); var binder = new DataBinder(obj, a.Name, bindedObject, propertyName); prop.SetValue(obj, binder, null); } else if (prop.PropertyType == typeof(ActionHandler)) { var handler = new ActionHandler(aValue, stack); prop.SetValue(obj, handler, null); } else if (prop.PropertyType == typeof(ActionHandlerEx)) { var handler = new ActionHandlerEx(aValue, stack, obj); prop.SetValue(obj, handler, null); } else { object mexpr = stack.Evaluate(aValue, prop.PropertyType); prop.SetValue(obj, mexpr, null); } } } }