Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing application parameters directly from service

Is it possible to access parameters defined in the ApplicationManifest.xml directly from your SF services?

I know you can define parameters on service level and provide overrides (as described here) but it is very cumbersome. If you have several services accessing same parameter (e.g. connection string) then it would be much easier to have it defined in a single place, like app manifest.

like image 931
filip Avatar asked Mar 07 '26 20:03

filip


1 Answers

It's possible, but not easy.

  1. Get the manifest xml:
var fc = new FabricClient();         
var application = (await fc.QueryManager.GetApplicationListAsync(new Uri (Context.CodePackageActivationContext.ApplicationName))).Single();         
var applicationManifest = await fc.ApplicationManager.GetApplicationManifestAsync(application.ApplicationTypeName,
 application.ApplicationTypeVersion);
  1. Use that xml to deserialize an object based on the XSD schema. C:\Program Files\Microsoft SDKs\Service Fabric\schemas\ServiceFabricServiceModel.xsd (ApplicationManifestType)

(sorry about the formatting)

like image 108
LoekD Avatar answered Mar 09 '26 09:03

LoekD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!