4

Trying to use custom application configuration in my service. This post gives part of the answer, but it doesn't explain how & where you initialize the ServiceInitializationParameters object, which is required to get it working. The object does not seem to have a constructor. Documentation from Microsoft is sketchy and the provided sample on GitHub does not seem to use any custom app config.

Community
  • 1
  • 1
Dan Toomey
  • 61
  • 5

1 Answers1

3

This post is based on the preview SDK. In the release version (2.0+) of the SDK, ServiceInitializationParameters was replaced with ServiceContext and its derived stateless and stateful versions. Check out the release notes for a comprehensive list of all the changes from preview to release.

Everything else in this post is still accurate, but you access the config stuff like this now:

 var configurationPackage = this.Context.CodePackageActivationContext.GetConfigurationPackageObject("Config");

 var connectionStringParameter = configurationPackage.Settings.Sections["UserDatabase"].Parameters["UserDatabaseConnectionString"];
Community
  • 1
  • 1
Vaclav Turecek
  • 9,020
  • 24
  • 29
  • 1
    this update should be reflected on the official doco page https://azure.microsoft.com/en-us/documentation/articles/service-fabric-cloud-services-migration-worker-role-stateless-service/ – Sean Feldman May 19 '16 at 06:44