using System.Text.Json; using Bit.Core.Enums; using Bit.Core.Utilities; namespace Bit.Core.Entities; public class OrganizationConnection : OrganizationConnection where T : new() { public new T Config { get => base.GetConfig(); set => base.SetConfig(value); } } public class OrganizationConnection : ITableObject { public Guid Id { get; set; } public OrganizationConnectionType Type { get; set; } public Guid OrganizationId { get; set; } public bool Enabled { get; set; } public string Config { get; set; } public void SetNewId() { Id = CoreHelpers.GenerateComb(); } public T GetConfig() where T : new() { try { return JsonSerializer.Deserialize(Config); } catch (JsonException) { return default; } } public void SetConfig(T config) where T : new() { Config = JsonSerializer.Serialize(config); } }