ubeac / ubeac-api

Source of uBeac .NET Core packages
3 stars 2 forks source link

Implement History #79

Closed ilhesam closed 2 years ago

pournasserian commented 2 years ago

@ilhesam please add another method: Task AddToHistory(T data, string actionName = "None", CancellationToken cancellationToken = default);

pournasserian commented 2 years ago

@ilhesam this is not correct model:

namespace uBeac;

public interface IHistoryEntity<TKey> : IEntity<TKey>
    where TKey : IEquatable<TKey>
{
    object Data { get; set; }
    string ActionName { get; set; }
    DateTime CreatedAt { get; set; }
}

public interface IHistoryEntity : IEntity, IHistoryEntity<Guid>
{
}

public class HistoryEntity<TKey> : Entity<TKey>, IHistoryEntity<TKey>
    where TKey : IEquatable<TKey>
{
    public virtual object Data { get; set; }
    public virtual string ActionName { get; set; }
    public virtual DateTime CreatedAt { get; set; }
}

public class HistoryEntity : HistoryEntity<Guid>, IHistoryEntity
{
}
pournasserian commented 2 years ago

@ilhesam it should be like this:

namespace uBeac;

public interface IHistoryEntity<TKey> 
    where TKey : IEquatable<TKey>
{
    object Data { get; set; }
    string ActionName { get; set; }
    DateTime CreatedAt { get; set; }
}
pournasserian commented 2 years ago

@ilhesam and add Context property to History class

IApplicationContext Context { get; set; }