Exemplo n.º 1
0
 /// <summary>
 /// Convert to service model
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static PublisherConfigModel ToServiceModel(
     this PublisherConfigApiModel model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new PublisherConfigModel {
         Capabilities = model.Capabilities?.ToDictionary(k => k.Key, v => v.Value),
         HeartbeatInterval = model.HeartbeatInterval,
         JobCheckInterval = model.JobCheckInterval,
         JobOrchestratorUrl = model.JobOrchestratorUrl,
         MaxWorkers = model.MaxWorkers
     });
 }
 /// <summary>
 /// Update an config
 /// </summary>
 /// <param name="config"></param>
 /// <param name="update"></param>
 public static PublisherConfigApiModel Patch(this PublisherConfigApiModel update,
                                             PublisherConfigApiModel config)
 {
     if (update == null)
     {
         return(config);
     }
     if (config == null)
     {
         config = new PublisherConfigApiModel();
     }
     config.Capabilities       = update.Capabilities;
     config.HeartbeatInterval  = update.HeartbeatInterval;
     config.JobCheckInterval   = update.JobCheckInterval;
     config.JobOrchestratorUrl = update.JobOrchestratorUrl;
     config.MaxWorkers         = update.MaxWorkers;
     return(config);
 }