RDW00006: Factory parameter not an object
Severity: Error · Family: RDW (RDCore.Web) · Raised by: NonObjectFactoryParameterAnalyzer
A parameter of a factory is not of an object type. A controller class with a default instance is made for each request by its factory, the function
'@ControllerFactory names or Create; a '@Service class with a default instance is made by its Create. The factory runs on the default instance,
and each of its parameters is given the service that its declared type names. A service is an object, so a parameter of any other type is given
nothing, and the host refuses the program at startup.
It is reported at each such parameter. A parameter is of an object type when it is declared as a class, an interface or Object, and is not an array.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
| A value the factory was written to take. | Public Function Create(ByVal pageSize As Long) As RDWeb.IController in OrdersController. |
Read the value from a service: a class that '@Service declares, whose Create takes RDWeb.Configuration or that has the value itself. |
| A factory that takes a parameter per property. | Public Function Create(ByVal name As String, ByVal repository As IOrderRepository) As IOrderService in a '@Service class. |
Keep the object parameters. The others are the class's own state, which Create sets on the object it makes. |
| A parameter with no type, or an array. | ByVal options (a Variant), ByRef names() As String, ParamArray values(). |
Declare it as the service's class or interface. |