/// <summary> /// Convert to service model /// </summary> /// <param name="registration"></param> /// <returns></returns> public static PublisherModel ToServiceModel(this PublisherRegistration registration) { return(new PublisherModel { Id = PublisherModelEx.CreatePublisherId(registration.DeviceId, registration.ModuleId), SiteId = registration.SiteId, Certificate = registration.Certificate?.DecodeAsByteArray(), LogLevel = registration.LogLevel, Configuration = registration.ToConfigModel(), Connected = registration.IsConnected() ? true : (bool?)null, OutOfSync = registration.IsConnected() && !registration._isInSync ? true : (bool?)null }); }
/// <summary> /// Convert to service model /// </summary> /// <param name="registration"></param> /// <returns></returns> public static PublisherModel ToServiceModel(this PublisherRegistration registration) { if (registration == null) { return(null); } return(new PublisherModel { Id = PublisherModelEx.CreatePublisherId(registration.DeviceId, registration.ModuleId), SiteId = registration.SiteId, LogLevel = registration.LogLevel, Configuration = registration.ToConfigModel(), Version = registration.Version, Connected = registration.IsConnected() ? true : (bool?)null, OutOfSync = registration.IsConnected() && !registration._isInSync ? true : (bool?)null }); }