Hi Guys,
We would like to do this but the friendly name is not available in a brokenrule object.
private
static string GetValidationMessage(BaseElement element){
if (element.IsValid) return "The element has no validation errors."; else return string.Format("The {0} element has the following validation errors: {1}{2}",((
eElementType)element.Element_ElementTypePK).GetDescription(), Environment.NewLine, GetValidationErrors(element.BrokenRulesCollection));}
private static string GetValidationErrors(BrokenRulesCollection brokenRules){
StringBuilder builder = new StringBuilder();brokenRules.ToList().ForEach(x => builder.AppendFormat(
"\t{0}: {1}{2}", x.Property, x.Description, Environment.NewLine)); // TODO next version of CSLA will probably give us access to the friendly name so we can do this //brokenRules.ToList().ForEach(x => builder.AppendFormat("\t{0}: {1}{2}", x.FriendlyName, x.Description, Environment.NewLine)); // or this //brokenRules.ToList().ForEach(x => builder.AppendFormat("\t{0}: {1}{2}", x.GetType().GetProperty("FriendlyName"), x.Description, Environment.NewLine)); // For now we have to use the property name as a friendly name. return builder.ToString();}
Dear Johnny,
Thanks very much mate? But we are using CSLA cslacs-3.7.0-090710 and in that version PropertyInfoManager is an internal class. Maybe its available in another version?
Regards,
Alistair
arigney:
But we are using CSLA cslacs-3.7.0-090710 and in that version PropertyInfoManager is an internal class.
Awesome thanks Mate!
Kool so I guess I really need to ask what version of CSLA you recommend we use and is it much of a headache upgrading to that version. Maybe this has been "fixed" in a later release? Also with the version that you recommend, what other additions would you say that we need.
I guess we can pay you for any advice.We have been working on a big gov project here in Canberra Australia for the last year, we had to fight to get them to accept CSLA and the customer wouldn't let us use an ORM so we had to use our old dataset tools with CSLA as the ORM.
Best Regards,
Alistair
Copyright (c) Marimer LLC