Polymorphism: Techniques for specifying the class name at runtime [LSA Data Excellence]
How best to specify a dynamic class name at runtime for a Polymorphic setup?
What about guardrail warnings?
The primary techniques for specifying a dynamically specifying the runtime class for a page are:
Data Transform: Updating .pxObjClass property
The Dynamic Class Referencing pattern should be used in conjunction with this, delegating hardcoded class names into a single rule, which can be overridden across layers using a combination of Class and Ruleset Specialization. The class names needed at runtime are then looked up from a Data Page using references that - like Constants or Properties File references in programming languages - are implemented once and do not change.
One way or the other, all approaches yield guardrail warnings. The number of rules in which you will be dynamically determining the runtime type of a component of your data model is likely very small, and may be further reduced by considering how to make this available as a reusable capability for your application's needs.
A good design with (legitimate) justifications for the resulting warnings will likely have a negligible impact on your Guardrail Score.