Commit f2d225d8 authored by hasan khaddour's avatar hasan khaddour

refactor shared kernell

parent c26e64c8
......@@ -3,9 +3,9 @@ using System;
namespace PSManagement.SharedKernel.Events
{
public abstract class BaseDomainEvent : INotification
public interface IDomainEvent : INotification
{
public DateTime DateOccurred { get; protected set; } = DateTime.UtcNow;
public DateTime DateOccurred { get; set; }
}
}
using PSManagement.SharedKernel.Events;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace PSManagement.SharedKernel.Entities
{
public class BaseEntity
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public List<BaseDomainEvent> Events = new List<BaseDomainEvent>();
public List<IDomainEvent> Events = new ();
public void AddDomainEvent(BaseDomainEvent eventItem)
public void AddDomainEvent(IDomainEvent eventItem)
{
Events = Events?? new List<BaseDomainEvent>();
Events ??= new List<IDomainEvent>();
Events.Add(eventItem);
}
public void RemoveDomainEvent(BaseDomainEvent eventItem)
public void RemoveDomainEvent(IDomainEvent eventItem)
{
Events?.Remove(eventItem);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment