How do I access ApplicationTypeName specified in the applicationmanifest in c#code at runtime
I tried var applicationTypeName = FabricRuntime.GetActivationContext().ApplicationTypeName; var applicationName = FabricRuntime.GetActivationContext().ApplicationName; if (tracer != null) { tracer.Log($"applicationTypeName:{applicationTypeName}"); tracer.Log($"applicationName:{applicationName}"); } But this is giving me service nametype not application nametype.
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="xyz" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
In this example, I want xyz to be fetched.
ApplicationTypeNamespecified in the application manifest is not directly accessible from within the service code.We can dynamically retrieve and inspect the application manifest at runtime.
context.CodePackageActivationContextdirectly to access the activation context within theStatelessService.Here check this SO link, he used
FabricClientto query for the application manifest and then deserialize it into an object based on the XSD schema. By this he is able to access properties of that object, such asApplicationTypeName.ServiceManifest.xml: