[misc bug fixes]
properly hide broadcast failure messages if ignore connection lost is turned on fix concurent issue for update stats history that happened with new event processing make get/set additional property thread safe add ellipse to truncated chat messages on home
This commit is contained in:
@ -1,15 +1,41 @@
|
||||
using System;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SharedLibraryCore.Database.Models
|
||||
{
|
||||
public class SharedEntity
|
||||
public class SharedEntity : IPropertyExtender
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, object> _additionalProperties;
|
||||
|
||||
/// <summary>
|
||||
/// indicates if the entity is active
|
||||
/// </summary>
|
||||
public bool Active { get; set; } = true;
|
||||
|
||||
public SharedEntity()
|
||||
{
|
||||
_additionalProperties = new ConcurrentDictionary<string, object>();
|
||||
}
|
||||
|
||||
public T GetAdditionalProperty<T>(string name)
|
||||
{
|
||||
return _additionalProperties.ContainsKey(name) ? (T)_additionalProperties[name] : default;
|
||||
}
|
||||
|
||||
public void SetAdditionalProperty(string name, object value)
|
||||
{
|
||||
if (_additionalProperties.ContainsKey(name))
|
||||
{
|
||||
_additionalProperties[name] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_additionalProperties.TryAdd(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Specifies when the entity was created
|
||||
///// </summary>
|
||||
|
Reference in New Issue
Block a user