L2Bot2.0/Client/Domain/Service/ItemHandler.cs
2023-11-11 14:33:22 +04:00

31 lines
890 B
C#

using Client.Domain.Entities;
using Client.Domain.Events;
using Client.Domain.Factories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Client.Domain.Service
{
public class ItemHander : EntityHandler<ItemInterface>
{
public override void OnCreate(ItemInterface entity)
{
eventBus.Publish(new ItemCreatedEvent(entity));
}
public override void OnDelete(ItemInterface entity)
{
eventBus.Publish(new ItemDeletedEvent(entity.Id));
}
public ItemHander(EntityFactoryInterface<ItemInterface> factory, EntityFactoryInterface<Entity> entityFactory, EventBusInterface eventBus) : base(factory, entityFactory)
{
this.eventBus = eventBus;
}
private readonly EventBusInterface eventBus;
}
}