Table of Contents

RDW00005: Duplicate service name

Severity: Error  ·  Family: RDW (RDCore.Web)  ·  Raised by: RDWebServiceReader

Two classes of the program declare one service name with '@Service. A service's name is the type a parameter declares to be given it, so a parameter declared as that type could be given an object of either class. The host refuses the program at startup, and serves nothing, with a message that names both classes and the name. Names are compared without regard to case, as VBA identifiers are (MS-VBAL §3.3.5).

A '@Service with no name declares the class's own name. Two classes are reported even when Program.Run also registers their name: the registration decides what a parameter is given, and the two annotations still declare one name.

Note

Not implemented. Neither the editor nor the host reports it. No analyzer reads the services of every module of a project, and the RDCore.Web host composes no program (§7.2).

How it is raised

Situation Example Resolution
Two implementations of one interface. '@Service("IOrderRepository") in the class SqlOrders, and in the class MemoryOrders. Keep the annotation on the class the program uses. A test that wants the other one makes it itself.
A class named as another class's service. '@Service in the class Clock, and '@Service("Clock") in the class FrozenClock. Let FrozenClock declare its own name ('@Service with no argument), or have both classes implement an interface, and declare its name on one class only.
The same name in another case. '@Service("IClock") in SystemClock, and '@Service("iclock") in FrozenClock. As above: one class per name, in any case.

See also