Class RDWebServiceReader
- Namespace
- RDCore.Web.Services
- Assembly
- RDCore.Web.dll
Reads the services of a program from the '@Service annotations of its classes: '@Service, '@Service("IOrderRepository"),
'@Service("IClock", "Singleton"), in a class's declarations section.
public static class RDWebServiceReader
- Inheritance
-
RDWebServiceReader
- Inherited Members
Remarks
A service's name is the type a parameter declares to be given it: the annotation's first argument, or the class's own name without one. The class is that
type, or names it in an Implements statement (MS-VBAL §5.2.4.2). Its lifetime is the second argument, Scoped,
Transient or Singleton in any case, and Scoped without one. Names are compared without regard to case, as VBA names are
(MS-VBAL §3.3.5).
Fields
DefaultFactory
The function that makes the object of a class with a default instance, a service or a factory-made controller, when no annotation names another:
Create. It runs on the default instance, and its parameters are services.
public const string DefaultFactory = "Create"
Field Value
Methods
Distinct(IEnumerable<RDWebService>)
The services of a program, each name once (RDW00005).
public static ImmutableArray<RDWebService> Distinct(IEnumerable<RDWebService> services)
Parameters
servicesIEnumerable<RDWebService>The service each class of the program declares (Read(ModuleParseResult, string, ModuleType)).
Returns
- ImmutableArray<RDWebService>
The services, in the order they are given.
Exceptions
- RDWebServiceException
Two classes declare one service name; the message names both, and the name.
Read(ModuleParseResult, string, ModuleType)
The service a module declares.
public static RDWebService? Read(ModuleParseResult parse, string moduleName, ModuleType moduleType)
Parameters
parseModuleParseResultThe module's parse; for a file that has blocks, the parse of the one module.
moduleNamestringThe module's name.
moduleTypeModuleTypeThe module's kind: only a class module declares a service.
Returns
- RDWebService
The service; null when the module has no
'@Service.
Exceptions
- RDWebServiceException
The module is not a class module, the lifetime is not one of RDWebServiceLifetime, or the class is not the type its name is and names it in no
Implementsstatement.