Commit 28a0eccc authored by hasan khaddour's avatar hasan khaddour

Add Share Kernel Elements.

parent 5904697d
...@@ -6,5 +6,6 @@ namespace PSManagement.SharedKernel.Events ...@@ -6,5 +6,6 @@ namespace PSManagement.SharedKernel.Events
public abstract class BaseDomainEvent : INotification public abstract class BaseDomainEvent : INotification
{ {
public DateTime DateOccurred { get; protected set; } = DateTime.UtcNow; public DateTime DateOccurred { get; protected set; } = DateTime.UtcNow;
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.SharedKernel.DomainException
{
public abstract class BadRequestException : DomainException
{
protected BadRequestException(string message)
: base(message)
{
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSManagement.SharedKernel.DomainException
{
public abstract class NotFoundException : DomainException
{
protected NotFoundException(string message)
: base(message)
{
}
}
}
...@@ -8,6 +8,18 @@ namespace PSManagement.SharedKernel.Entities ...@@ -8,6 +8,18 @@ namespace PSManagement.SharedKernel.Entities
public int Id { get; set; } public int Id { get; set; }
public List<BaseDomainEvent> Events = new List<BaseDomainEvent>(); public List<BaseDomainEvent> Events = new List<BaseDomainEvent>();
public void AddDomainEvent(BaseDomainEvent eventItem)
{
Events = Events?? new List<BaseDomainEvent>();
Events.Add(eventItem);
}
public void RemoveDomainEvent(BaseDomainEvent eventItem)
{
Events?.Remove(eventItem);
}
public static bool operator ==(BaseEntity first, BaseEntity second) public static bool operator ==(BaseEntity first, BaseEntity second)
{ {
if (first is null && second is null) if (first is null && second is null)
......
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