title: WCF Service Access in static class
body: <pre><code>public static IEnumerable&lt;HospitalEntities&gt; GetAllHospitalDetails(HospitalRequest hospitalRequest)
  {
      CommonClass commonClass = new CommonClass();
      try
      {
          return Mapper.Map&lt;IEnumerable&lt;HospitalDto&gt;, List&lt;HospitalEntities&gt;&gt;(new HealthServiceClient().GetAllHospitalDetails(new HospitalRequestDto
          {
              ApplicationContext = Mapper.Map&lt;ApplicationContext, ApplicationContextDto&gt;(commonClass.ApplicationContext),
              TenantContext = Mapper.Map&lt;TenantContext, TenantContextDto&gt;(commonClass.TenantContext),
              UserContext = Mapper.Map&lt;UserContext, UserContextDto&gt;(commonClass.UserContext),
              SelectedTenantId = hospitalRequest.SelectedTenantId,
              hospitalDto = Mapper.Map&lt;HospitalEntities, HospitalDto&gt;(hospitalRequest.hospitals)
          }).hospitalResponseDto);
      }
      catch (Exception Ex)
      {
          ExceptionPolicy.HandleException(Ex, ExceptionPolicies.UI_POLICY, (Int32)ExceptionConstant.EventId.ERR_UI_HEALTH_HealthServiceHelper_GetAllHospitalDetails, "ManageVaccinationMaster.aspx", Conversion.ConvertToString(commonClass.TenantContext.TenantId), Conversion.ConvertToString(commonClass.TenantContext.ClientCode), Conversion.ConvertToString(commonClass.UserContext.UserId));
          throw Ex;
      }
  }
  </code></pre>
  
  <p>Is this approach right? Does WCF connection remain opened? Is it good to access WCF service from static class?</p>