I want initialise a property from the Factura Entity using Domain Event Pattern. The code in the constructor is:
public class Factura : Entity
{
public Factura()
{
this.Fecha = DateTime.Now;
this.CodigoMoneda = 2;
DomainEvents.Raise(new NuevaFacturaEvent(this));
}
}
The code in the handler is:
public class CompletarFacturaHandler: IHandles<NuevaFacturaEvent>
{
private readonly ILinqRepository<Parametro> parametroRepository;
public CompletarFacturaHandler(ILinqRepository<Parametro> parametroRepository)
{
this.parametroRepository = parametroRepository;
}
public void Handle(NuevaFacturaEvent nuevaFacturaEvent)
{
if (nuevaFacturaEvent == null)
{
throw new ArgumentNullException("nuevaFacturaEvent");
}
var ruc = parametroRepository.FindAll().Single(p => p.Codigo == 2 && p.CodigoUniversidad == 1);
nuevaFacturaEvent.Factura.Ruc = ruc.Texto;
}
}
But I get the following error:
An ISessionFactory does not exist with a factory key of nhibernate.current_session
What can I do?
Aucun commentaire:
Enregistrer un commentaire