2020-04-25 20:01:26 -04:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Concurrent;
|
2019-11-25 13:05:12 -05:00
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2017-11-25 20:29:58 -05:00
|
|
|
|
|
2018-04-08 02:44:42 -04:00
|
|
|
|
namespace SharedLibraryCore.Database.Models
|
2017-11-25 20:29:58 -05:00
|
|
|
|
{
|
2020-04-25 20:01:26 -04:00
|
|
|
|
public class SharedEntity : IPropertyExtender
|
2017-11-25 20:29:58 -05:00
|
|
|
|
{
|
2020-04-25 20:01:26 -04:00
|
|
|
|
private readonly ConcurrentDictionary<string, object> _additionalProperties;
|
|
|
|
|
|
2019-11-25 13:05:12 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// indicates if the entity is active
|
|
|
|
|
/// </summary>
|
2018-09-12 20:53:11 -04:00
|
|
|
|
public bool Active { get; set; } = true;
|
2019-11-25 13:05:12 -05:00
|
|
|
|
|
2020-04-25 20:01:26 -04:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-25 13:05:12 -05:00
|
|
|
|
///// <summary>
|
|
|
|
|
///// Specifies when the entity was created
|
|
|
|
|
///// </summary>
|
|
|
|
|
//[Column(TypeName="datetime")]
|
|
|
|
|
//public DateTime CreatedDateTime { get; set; }
|
|
|
|
|
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// Specifies when the entity was updated
|
|
|
|
|
///// </summary>
|
|
|
|
|
//[Column(TypeName = "datetime")]
|
|
|
|
|
//public DateTime? UpdatedDateTime { get;set; }
|
2017-11-25 20:29:58 -05:00
|
|
|
|
}
|
|
|
|
|
}
|