Implementation Dynamic Services
Purpose of Dynamic Services
With Dynamic Services you can intervene in the SQL statements in the xml files and thus dynamically edit the syntax of the SQL statement. Among other things, the searches can be adapted to the user´s language or the search can be restricted for certain conditions.
Implementation
Structure of Dynamic Services
The Dynamic Services are located in the Innosoft.CRM.Core-Namespace under Services. These services all implement the IDynamicObject interface, which means that all Dynamic Services must include the GetValues function. GetValues expects a string array. as input parameter and returns a string which is then written to the SQL. The service can also include other functions, but these must include "params string[] arg" as an input parameter and return a string. Furthermore, the service can also contain a constructor. Global variables can then be initialized in this, which can use several functions. In the service can be read from the stream parameters that can be used to initialize global variables. For this you have to call the function Utils.GetRequestStreamValues(HttpContext.Current.Request). This will return a dictionary of string-object pairs. Also set a default value as the function can also return NULL. You can read the required value from this dictionary. The keys should all start with "cus_".
Implementation in the app
The Dynamic Services are called within three curly brackets. The curly brackets contain the namespace of the service (Innosoft.CRM.Core.Service.DynamicObjectsService.DynamicObjects) followed by the actual name of the Dynamic Service. If you want to call the default GetValues, the name of the class is followed by a question mark and the parameters to be passed to the function (e.g.: Innosoft.CRM.Core.Service.DynamicObjectsService.DynamicObjects.MachineService?Where). To call another function, the name of the service is followed by a vertical bar and then the name of the function. The parameters are now passed as in the GetValues function (e.g.: Innosoft.CRM.Core.Service.DynamicObjectsService.DynamicObjects.GeomapService|GetWhereClause).