protected override void ProcessRecord()
        {
            try
            {
                var dllPath     = ModuleHelper.InstallDir + "ServiceBroker\\" + ServiceTypeAssembly;
                var brokerClass = _managementServer.GetRegisterableServices()
                                  .Where(service => service.Value == dllPath)
                                  .Select(p => p.Key).FirstOrDefault();

                if (_managementServer.GetServiceType(_serviceTypeGuid) != null)
                {
                    WriteVerbose($"Updating existing Service Type {SystemName}");
                    _managementServer.UpdateServiceType(_serviceTypeGuid, SystemName, DisplayName, Description, dllPath,
                                                        brokerClass);
                }
                else
                {
                    WriteVerbose("Registering the following Service Type:");
                    WriteVerbose($"System Name - {SystemName}");
                    WriteVerbose($"Display Name - {DisplayName}");
                    WriteVerbose($"Guid - {_serviceTypeGuid}");
                    _managementServer.RegisterServiceType(_serviceTypeGuid, SystemName, DisplayName, Description,
                                                          brokerClass);
                }
            }
            catch (Exception ex)
            {
                ErrorHelper.Write(ex);
            }
        }
Example #2
0
 internal virtual IDictionary <string, string> GetRegisterableServices()
 {
     return(_serviceManagementServer.GetRegisterableServices());
 }