UseParentFullNamePaths
Type: System.Boolean
Gets or sets the value indicating whether Rule Editor should use dot notation instead of declared names of reference types when it sets DisplayName values of rule fields, in-rule methods and rule actions during recursive search for value type properties. The default value is False.
Let's consider a plain class Parent with no Code Effects attributes:
using CodeEffects.Rule.Attributes;
namespace HelloWorld
{
public class Patient
{
public Middle Test { get; set; }
}
public class Middle
{
public Address Home { get; set; }
public Address Work { get; set; }
}
public class Address
{
public string Street { get; set; }
public string Zip { get; set; }
}
}
If we run an imaginery web app with Rule Editor and this class as its source object we would see the following field menu:
This menu does its job just fine. But it's likely that you would want to have "normal" names for your fields even if they are burried deep inside of your source object. If we decorate this class with SourceAttribute, set the value of its UseParentFullNamePaths property to True, decorate members of the Address class with ParentAttribute, use dot notation to set the exact path of each reference type down to its value types...
using CodeEffects.Rule.Attributes;
namespace HelloWorld
{
[Source(UseParentFullNamePaths = true)]
public class Patient
{
public Middle Test { get; set; }
}
public class Middle
{
public Address Home { get; set; }
public Address Work { get; set; }
}
public class Address
{
[Parent("Test.Home", "Home Street")]
[Parent("Test.Work", "Work Street")]
public string Street { get; set; }
[Parent("Test.Home", "Home Zip")]
[Parent("Test.Work", "Work Zip")]
public string Zip { get; set; }
}
}
... and then run our project again we get the result we were looking for:
As you can see, this property works quite nicely in tandem with ParentAttribute.ParentName if the structure of your source is more complicated than just a single level of reference typed properties or if you don't know the exact structure of your source at design-time. Obviously, if the value of this property if set to True you can use paths with any number of levels as the value of ParentAttribute.ParentName, such as "Test.One.Two.Three.Home".