Hello everyone,
I have the same question posed in this thread, which was unfortunately left unanswered: Implementing custom service object: reach access to service instance configuration settings?
To restate, I'm creating a custom static service broker for our K2 project. In the service broker .cs file, in the GetConfigSection I have the following code:
this.Service.ServiceConfiguration.Add("WebService URL", true, String.Empty);this.Service.ServiceConfiguration.Add("Client ID", true, String.Empty);
In the service object itself I need to access both the WebService URL and the Client ID values. Following the 400.BLR module handbook, and the source code for another custom service broker found in the Underground, I've added the following code to the service object:
private ServiceConfiguration _serviceConfig;public ServiceConfiguration ServiceConfiguration{ get { return _serviceConfig; } set { _serviceConfig = value; }}
And then to access the values from the ServiceConfiguration I call:
filterService.Url = this.ServiceConfigurationf"WebService URL"].ToString();
All this compiles fine and the K2 SmartObject Tester is able to register it and create a SmartObject with it. However, when I attempt to run the SmartObject I get an "Object reference not set to an instance of an object" error at the line where I call ServiceConfigurationo"WebService URL"].
Am I missing a step here?
Any help would be appreciated. Thank you!