/// <summary> /// Updates the service app in the container or adds a new one to it if it does not exist. /// </summary> /// <param name="serviceApp">The service application.</param> /// <param name="dao">The DAO.</param> /// <param name="appListDao">The application list DAO.</param> /// <returns> /// An error message if there was a problem updating the service app /// </returns> public string UpdateServiceApp(ServiceApp serviceApp, IServiceAppDao dao, IAppListDao appListDao) { // TODO: move validation outside of here (breaks SRP) ServiceAppValidator validator = new ServiceAppValidator(); if (serviceApp == null) { return("Cannot update null service app"); } if (!validator.ValidateServiceApp(serviceApp)) { return(string.Format("Service app to update is invalid. Reason: {0}", string.Join(", ", validator.ErrorMessages))); } return(this.SyncServiceApp(serviceApp, dao, appListDao)); }
public void Initialize() { _validator = new ServiceAppValidator(); }