Service Configuration

The service layer is the part of the business logic that represents the interface to the integration and the presentation layers of a software system. The service layer encapsulates algorithms and business transactions consistent interface to the outside that is assembled from simple abstractions:

  • Connection endpoint (e.g. URL), depending on the connection technology
  • Methods (method name and parameter signature)
  • Parameter types (simple or complex) to define the structure of the method parameters

The service layer as part of the business logic provides the methods in the form of compiled modules (assemblies). The methods that can be used as service methods must be specifically marked because not every method qualifies as an external interface method. On the implementation side, the service layer is assembled from these abstractions:

  • Modules as compiled containers of service methods
  • Method implementations (with parameters and parameter types)
  • Method Categories as a declarative classification mechanism. Each method implementation can have one or multiple categories associated by assiging one or multiple code attributes to the method declarations.

A typical service method is implemented and decorated like this (the example is taken from the ice.NET Studio Service, an interface that provides functionality to development tools):

[ServiceMethod]
[ServiceCategory("IceNet.API")]
[ServiceCategory("IceNet.Studio")]
[Description("Retrieves the detailed data of an object type identified by its ID.")]        
public void ObjTypeGetDetails(
    [ServiceParameter("Id")]                 string             objTypeId,
    [ServiceParameter("Inherited")]          bool               inherited,
    [ServiceParameter("ObjTypeInfo")]        out ObjTypeInfo    sInfo,
    [ServiceParameter("SupertypesList")]     out ObjTypeInfo[]  aSupertypes,
    [ServiceParameter("SubtypesList")]       out ObjTypeInfo[]  aSubtypes,
    [ServiceParameter("AttrDefList")]        out AttrDefInfo[]  aAttrDefs)
{
    ...
}

This service method that is part of the PDTec.IceNet.Domain module is associated with the service categories IceNet.API and IceNet.Studio.

Definition of a service

Now that we have described the implementation and interface components of a service, the remaining problem is: How to define the interface of a specific service. The following diagram illustrates the ice.NET methodology:

The specific service is specified by a configuration that contains two sets of information:

  • One or many modules (assemblies) that contain service methods
  • One or many service categories that serve as a filter for selecting appropriate methods

The result of this configuration is a consistent service interface that assembles all (qualified) methods from the specified modules that have assigned one or more categories of the configuration. The parameter types of the interface are selected implicitly: all types that are used in the selected methods are part of the service interface.