/// <summary> /// Creates an instance of IImunizationFhirDelegate via configuration. /// </summary> /// <returns>The IImunizationFhirDelegate.</returns> public IImmunizationFhirDelegate CreateInstance() { string typeStr = this.configuration.GetValue <string>("ImmunizationDelegate", DefaultInstance); Type? type = Type.GetType(typeStr); IImmunizationFhirDelegate instance = (IImmunizationFhirDelegate)ActivatorUtilities.CreateInstance(this.serviceProvider, type); return(instance); }
/// <summary> /// Initializes a new instance of the <see cref="ImmunizationService"/> class. /// </summary> /// <param name="logger">Injected Logger Provider.</param> /// <param name="httpAccessor">The injected http context accessor provider.</param> /// <param name="immunizationDelegateFactory">The factory to create immunization delegates.</param> /// <param name="patientDelegate">The injected patient delegate.</param> public ImmunizationService( ILogger <ImmunizationService> logger, IHttpContextAccessor httpAccessor, IImmunizationDelegateFactory immunizationDelegateFactory, IPatientDelegate patientDelegate) { this.logger = logger; this.httpContextAccessor = httpAccessor; this.immunizationDelegate = immunizationDelegateFactory.CreateInstance(); this.patientDelegate = patientDelegate; }