The document discusses implementing CQRS and event sourcing patterns using RavenDB for persistence. It begins with an example employee management prototype and identifies issues with the initial approach. It then explores improving the model by defining commands, events, and having entities generate events in response to commands. Events are stored in RavenDB to rebuild entity state and allow queries to be answered from the event stream. The document provides examples of handling commands, generating and applying events, and saving events to documents in RavenDB.
Se guardiamo oltre la meccanica, il TDD è una tecnica complessa perché richiede molteplici skill. Da principiante dopo l’implementazione di poche storie ti imbatti nel problema dei test che si rompono ad ogni refactoring, è arrivato il momento di migliorare i propri skill di scrittura dei test. Nel talk analizzeremo la struttura dei test, quali sono le bad smell più comuni e come porvi rimedio.
Slides from my GeeCON 2014 Prague talk:
"Groovy is a dynamic language that provides different types of metaprogramming techniques. In this talk we’ll mainly see runtime metaprogramming. I’ll explain Groovy Meta-Object-Protocol (MOP), the metaclass, how to intercept method calls, how to deal with method missing and property missing, the use of mixins, traits and categories. All of these topics will be explained with examples in order to understand them.
Also, I’ll talk a little bit about compile-time metaprogramming with AST Transformations. AST Transformations provide a wonderful way of manipulating code at compile time via modifications of the Abstract Syntax Tree. We’ll see a basic but powerful example of what we can do with AST transformations."
The code is available at: https://github.com/lmivan/geecon2014-prague-metaprograming-with-groovy
O quanto você está satisfeito com o código que produz? Mais ainda: o quanto você está satisfeito como profissional? Na busca pela melhoria de nossas aplicações, caímos num grande desafio: melhorar a nós mesmos!
Numa conversa franca e descontraída, Samuel e Victor tentarão apresentar idéias sobre como você pode melhorar seu próprio trabalho e sentir orgulho do que faz.
Se guardiamo oltre la meccanica, il TDD è una tecnica complessa perché richiede molteplici skill. Da principiante dopo l’implementazione di poche storie ti imbatti nel problema dei test che si rompono ad ogni refactoring, è arrivato il momento di migliorare i propri skill di scrittura dei test. Nel talk analizzeremo la struttura dei test, quali sono le bad smell più comuni e come porvi rimedio.
Slides from my GeeCON 2014 Prague talk:
"Groovy is a dynamic language that provides different types of metaprogramming techniques. In this talk we’ll mainly see runtime metaprogramming. I’ll explain Groovy Meta-Object-Protocol (MOP), the metaclass, how to intercept method calls, how to deal with method missing and property missing, the use of mixins, traits and categories. All of these topics will be explained with examples in order to understand them.
Also, I’ll talk a little bit about compile-time metaprogramming with AST Transformations. AST Transformations provide a wonderful way of manipulating code at compile time via modifications of the Abstract Syntax Tree. We’ll see a basic but powerful example of what we can do with AST transformations."
The code is available at: https://github.com/lmivan/geecon2014-prague-metaprograming-with-groovy
O quanto você está satisfeito com o código que produz? Mais ainda: o quanto você está satisfeito como profissional? Na busca pela melhoria de nossas aplicações, caímos num grande desafio: melhorar a nós mesmos!
Numa conversa franca e descontraída, Samuel e Victor tentarão apresentar idéias sobre como você pode melhorar seu próprio trabalho e sentir orgulho do que faz.
Expression trees in c#, Алексей Голубь (Svitla Systems)Alina Vilk
рассказывал про это понятие и способы генерации деревьев выражений, о превращении пользовательской грамматики непосредственно в исполняемый код; поделился информацией о написании быстрых универсальных операторов и компиляции сборок во время выполнения
Good and Bad Code
The Broken Window Theory
The Grand Redesign in the Sky
The Sushi Chef Rule
The Hotel Room Rule
The Boy Scout Rule
OOP Patterns and Principles
SOLID Principles
How to measure clean code?
Tools
Wiktor Toporek: Pomimo tego że JavaScript mocno ewoluował na przestrzeni ostatnich lat, zakorzeniona w nim jego asynchroniczna natura wciąż może sprawiać problem programistom i to zarówno początkującym jak i tym zaawansowanym. W prezentacji przyjrzymy się jednemu z bohaterów programowania asynchronicznego jakim jest Promise, przeanalizujemy niektóre z pułapek oraz zastanowimy się również czy w pełni wykorzystujemy jego potencjał.
Video: https://www.youtube.com/watch?v=SfrEThI_m7g
Source code: https://github.com/Alotor/2015-greach-groovy-dsls
Behind each good Groovy library or framework there is a good DSL (Domain Specific Language). And this is not by chance, one of the most exciting features of Groovy is its amazing syntax flexibility and metaprogramming capabilities that allow us do things in a highly expressive manner through DSLs.
In this talk I’ll explain the basics of doing DLS’s with Groovy. What you’ll need to start and what to investigate deeper. Also, we’ll check some of the most well known ones libraries like Spock, Gradle or Grails so you can use their techniques in your own Groovy projects.
Wiktor Toporek: JavaScript, będąc dynamicznie typowanym językiem, potrafi być bardzo przyjazny… niestety również bugom. Dobry przyjaciel powinien nam pozwalać na wiele, lecz nie powinien nam pozwalać na zrobienie sobie krzywdy. Podczas prezentacji przekonamy się, iż statyczne typowanie może stać się naszym dobrym przyjacielem w walce z dużym szeregiem błędów – ale to, w jakim stopniu nam pomoże, zależy od tego, jaki wkład będziemy mieli w tę relację.
Though Language INtegrated Query provides a revolutionary way to write code in C# 3.0 and Visual Basic 9, it is powerless without several enabling language features and libraries. This session will explore the technologies that make LINQ possible and show how you can use the same techniques to make LINQ work for you.
Presented Aug. 28 & 29, 2009 at St. Louis Day of .NET
Expression trees in c#, Алексей Голубь (Svitla Systems)Alina Vilk
рассказывал про это понятие и способы генерации деревьев выражений, о превращении пользовательской грамматики непосредственно в исполняемый код; поделился информацией о написании быстрых универсальных операторов и компиляции сборок во время выполнения
Good and Bad Code
The Broken Window Theory
The Grand Redesign in the Sky
The Sushi Chef Rule
The Hotel Room Rule
The Boy Scout Rule
OOP Patterns and Principles
SOLID Principles
How to measure clean code?
Tools
Wiktor Toporek: Pomimo tego że JavaScript mocno ewoluował na przestrzeni ostatnich lat, zakorzeniona w nim jego asynchroniczna natura wciąż może sprawiać problem programistom i to zarówno początkującym jak i tym zaawansowanym. W prezentacji przyjrzymy się jednemu z bohaterów programowania asynchronicznego jakim jest Promise, przeanalizujemy niektóre z pułapek oraz zastanowimy się również czy w pełni wykorzystujemy jego potencjał.
Video: https://www.youtube.com/watch?v=SfrEThI_m7g
Source code: https://github.com/Alotor/2015-greach-groovy-dsls
Behind each good Groovy library or framework there is a good DSL (Domain Specific Language). And this is not by chance, one of the most exciting features of Groovy is its amazing syntax flexibility and metaprogramming capabilities that allow us do things in a highly expressive manner through DSLs.
In this talk I’ll explain the basics of doing DLS’s with Groovy. What you’ll need to start and what to investigate deeper. Also, we’ll check some of the most well known ones libraries like Spock, Gradle or Grails so you can use their techniques in your own Groovy projects.
Wiktor Toporek: JavaScript, będąc dynamicznie typowanym językiem, potrafi być bardzo przyjazny… niestety również bugom. Dobry przyjaciel powinien nam pozwalać na wiele, lecz nie powinien nam pozwalać na zrobienie sobie krzywdy. Podczas prezentacji przekonamy się, iż statyczne typowanie może stać się naszym dobrym przyjacielem w walce z dużym szeregiem błędów – ale to, w jakim stopniu nam pomoże, zależy od tego, jaki wkład będziemy mieli w tę relację.
Though Language INtegrated Query provides a revolutionary way to write code in C# 3.0 and Visual Basic 9, it is powerless without several enabling language features and libraries. This session will explore the technologies that make LINQ possible and show how you can use the same techniques to make LINQ work for you.
Presented Aug. 28 & 29, 2009 at St. Louis Day of .NET
TDC2016SP - O que há de novo no Entity Framework Core 1.0tdc-globalcode
Venha conhecer a evolução do Entity Framework 7, agora Entity Framework Core 1.0. As novas features e principalmente como é a migração para a nova versão.
TDC2016SP - Novas Oportunidades para o .NET com a parceria Microsoft e Red Hattdc-globalcode
O mercado passa por mudanças muito interessantes, e uma delas é a adoção de Open Source pela Microsoft. Mais interessante ainda é ver uma parceria entre a Red Hat - a maior empresa de Open Source do mundo com a própria Microsoft. Neste cenário temos um conjunto novo de possibilidades para desenvolvedores .NET, permitindo que as aplicações .NET sejam executadas no Linux mais popular do mundo, tanto on-premise quanto na nuvem. Participe dessa palestra para entender um pouco do que está acontecendo com esta parceria e o que isso significa para a plataforma .NET.
Implementing CQRS and Event Sourcing with RavenDBOren Eini
CQRS stands for Command Query Responsibility Segregation. That is, that command stack and query stack are designed separately. This leads to a dramatic simplification of design and potential enhancement of scalability.
Events are a new trend in software industry. In real-world, we perform actions and these actions generate a reaction. Event Sourcing is about persisting events and rebuilding the state of the aggregates from recorded events.
In this talk I will share a lot of examples about how to effective implementing CQRS and Event Sourcing with RavenDB
Web2Day 2017 - Concilier DomainDriveDesign et API RESTNicolas Faugout
Talk au Tech2Day concernant l'approche RDD pour RestDrivenDomain qui nous permet chez Lucca de développer des domaines métiers exposés directement via des API REST.
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
Space is a team tool that integrates chats, meetings, git hosting, automation, and more. It has an HTTP API to integrate third party apps and workflows, but it's massive! And slightly opinionated.
In this session, we will see how we built the .NET SDK for Space, and how we make that massive API more digestible. We will see how we used code generation, and incrementally made the API feel more like a real .NET SDK.
If you thought Monads are a mystery, then this demonstration would show you how to evolve your code towards a Monad without knowing about it. This demo will neither go into any Category Theory nor begin with monadic laws. Instead, we will start with typical code that you see in your daily life as a developer, attempt to DRY (Don't Repeat Yourself) it up and eventually use Monad to remove duplication and verbosity. You'll also see how Monads make your code more declarative and succinct by sequencing the steps in your domain logic.
Also, we know in Java8 Checked Exceptions + λ == Pain! To be more precise, we will evolve a Try<t> (exception handling monad) which is missing in Java8, similar to one found in Scala.
Describing how to use Swift protocols to refactor obj-c networking layer to Swift while improving project architecture and test coverage. CocoaHeads-Berlin Sep 16
Come to this talk prepared to learn about the Doctrine PHP open source project. The Doctrine project has been around for over a decade and has evolved from database abstraction software that dates back to the PEAR days. The packages provided by the Doctrine project have been downloaded almost 500 million times from packagist. In this talk we will take you through how to get started with Doctrine and how to take advantage of some of the more advanced features.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
22. UI (HTML + Angular)
WebAPI
RavenDB
Presentation
Business
Persistence
23. Esse modelo não está anêmico?
public class Employee
{
public string Id { get; set; }
public string Name { get; set; }
public Address HomeAddress { get; set; }
public decimal Salary { get; set; }
}
24. Cadê a linguagem ubíqua?
[Route("api/[controller]")]
public class EmployeesController : Controller
{
[HttpGet]
public IEnumerable<Employee> Get()
{ /* .. */ }
[HttpGet("{id}")]
public Employee Get(string id)
{ /* .. */ }
[HttpPost]
public void Post([FromBody]Employee value)
{ /* .. */ }
[HttpPut("{id}")]
public void Put(string id, [FromBody]Employee value)
{ /* .. */ }
[HttpDelete("{id}")]
public void Delete(string id)
{ /* .. */}
}
58. Anatomia de um Evento
public class EmployeeHomeAddressChangedEvent
: VersionedEvent<Guid>
{
public Address NewAddress { get; }
public EmployeeHomeAddressChangedEvent(Address newAddress)
{
NewAddress = newAddress;
}
}
public class VersionedEvent<TSourceId> : IVersionedEvent<TSourceId>
{
public TSourceId SourceId { get; internal set; }
public DateTime When { get; private set; }
public int Version { get; internal set; }
public VersionedEvent()
{
When = DateTime.Now;
}
}
59. Anatomia de um Evento
public class EmployeeHomeAddressChangedEvent
: VersionedEvent<Guid>
{
public Address NewAddress { get; }
public EmployeeHomeAddressChangedEvent(Address newAddress)
{
NewAddress = newAddress;
}
}
public class VersionedEvent<TSourceId> : IVersionedEvent<TSourceId>
{
public TSourceId SourceId { get; internal set; }
public DateTime When { get; private set; }
public int Version { get; internal set; }
public VersionedEvent()
{
When = DateTime.Now;
}
}
60. Anatomia de um Evento
public class EmployeeHomeAddressChangedEvent
: VersionedEvent<Guid>
{
public Address NewAddress { get; }
public EmployeeHomeAddressChangedEvent(Address newAddress)
{
NewAddress = newAddress;
}
}
public class VersionedEvent<TSourceId> : IVersionedEvent<TSourceId>
{
public TSourceId SourceId { get; internal set; }
public DateTime When { get; private set; }
public int Version { get; internal set; }
public VersionedEvent()
{
When = DateTime.Now;
}
}
67. Entidade/Agregado gera Eventos
public void RaiseSalary(decimal amount)
{
Throw.IfArgumentIsNegative(amount, nameof(amount));
Update(new EmployeeSalaryRaisedEvent(amount));
}
68. Entidade/Agregado gera Eventos
public void ChangeHomeAddress(Address address)
{
Throw.IfArgumentIsNull(address, nameof(address));
Update(new EmployeeHomeAddressChangedEvent(address));
}
69. Atualiza estado a partir dos
Eventos
protected void Update(VersionedEvent<TId> e)
{
e.SourceId = Id;
e.Version = Version + 1;
_handlers[e.GetType()].Invoke(e);
Version = e.Version;
_pendingEvents.Add(e);
}
70. Atualiza estado a partir dos
Eventos
protected void Update(VersionedEvent<TId> e)
{
e.SourceId = Id;
e.Version = Version + 1;
_handlers[e.GetType()].Invoke(e);
Version = e.Version;
_pendingEvents.Add(e);
}
private Employee(Guid id) : base(id)
{
Handles<EmployeeRegisteredEvent>(OnEmployeeRegistered);
Handles<EmployeeSalaryRaisedEvent>(OnEmployeeSalaryRaised);
Handles<EmployeeHomeAddressChangedEvent>(OnEmployeeHomeAddressChanged);
}
71. Atualiza estado a partir dos
Eventos
protected void Update(VersionedEvent<TId> e)
{
e.SourceId = Id;
e.Version = Version + 1;
_handlers[e.GetType()].Invoke(e);
Version = e.Version;
_pendingEvents.Add(e);
}
private void OnEmployeeRegistered(EmployeeRegisteredEvent @event)
{
Name = @event.Name;
Salary = @event.InitialSalary;
}
private void OnEmployeeSalaryRaised(EmployeeSalaryRaisedEvent @event)
{
Salary += @event.Amount;
}
72. Atualiza estado a partir dos
Eventos
protected void Update(VersionedEvent<TId> e)
{
e.SourceId = Id;
e.Version = Version + 1;
_handlers[e.GetType()].Invoke(e);
Version = e.Version;
_pendingEvents.Add(e);
}
77. Salvar um documento com
eventospublic void Save(Employee employee)
{
var head = GetHead(employee.Id);
var storedVersion = GetStoredVersionOf(head);
if (storedVersion != (employee.Version - employee.PendingEvents.Count()))
throw new InvalidOperationException("Invalid object state.");
if (head == null)
{
SaveNewEmployee(employee);
}
else
{
SaveEmployeeEvents(employee);
}
foreach (var evt in employee.PendingEvents)
Bus.RaiseEvent(evt);
}
78. Salvar um documento com
eventos
public JsonDocumentMetadata GetHead(Guid id)
{
string localId = $"employees/{id}";
return _store.DatabaseCommands.Head(localId);
}
public int GetStoredVersionOf(JsonDocumentMetadata
head)
{
return head
?.Metadata[EmployeeEntityVersion]
.Value<int>() ?? 0;
}
79. Salvar um documento com
eventospublic void Save(Employee employee)
{
var head = GetHead(employee.Id);
var storedVersion = GetStoredVersionOf(head);
if (storedVersion != (employee.Version - employee.PendingEvents.Count()))
throw new InvalidOperationException("Invalid object state.");
if (head == null)
{
SaveNewEmployee(employee);
}
else
{
SaveEmployeeEvents(employee);
}
foreach (var evt in employee.PendingEvents)
Bus.RaiseEvent(evt);
}
80. Salvar um documento com
eventos
private void SaveNewEmployee(Employee employee)
{
using (var session = _store.OpenSession())
{
var document = new EmployeeEvents(
employee.Id,
employee.PendingEvents
);
session.Store(document);
session.Advanced.GetMetadataFor(document)
.Add(EmployeeEntityVersion, employee.Version);
session.SaveChanges();
}
}
81. private void SaveEmployeeEvents(
Employee employee )
{
var patches = new List<PatchRequest>();
foreach (var evt in employee.PendingEvents)
{
patches.Add(new PatchRequest
{
Type = PatchCommandType.Add,
Name = "Events",
Value = RavenJObject.FromObject(evt, _serializer)
});
}
var localId = $"employees/{employee.Id}";
var addEmployeeEvents = new PatchCommandData()
{
Key = localId,
Patches = patches.ToArray()
};
var updateMetadata = new ScriptedPatchCommandData()
{
Key = localId,
Patch = new ScriptedPatchRequest
{
Script = $"this['@metadata']['{EmployeeEntityVersion}'] = {employee.Version}; "
}
};
_store.DatabaseCommands.Batch(new ICommandData[]
{
addEmployeeEvents,
updateMetadata
});
}
82. private void SaveEmployeeEvents(
Employee employee )
{
var patches = new List<PatchRequest>();
foreach (var evt in employee.PendingEvents)
{
patches.Add(new PatchRequest
{
Type = PatchCommandType.Add,
Name = "Events",
Value = RavenJObject.FromObject(evt, _serializer)
});
}
var localId = $"employees/{employee.Id}";
var addEmployeeEvents = new PatchCommandData()
{
Key = localId,
Patches = patches.ToArray()
};
var updateMetadata = new ScriptedPatchCommandData()
{
Key = localId,
Patch = new ScriptedPatchRequest
{
Script = $"this['@metadata']['{EmployeeEntityVersion}'] = {employee.Version}; "
}
};
_store.DatabaseCommands.Batch(new ICommandData[]
{
addEmployeeEvents,
updateMetadata
});
}
83. private void SaveEmployeeEvents(
Employee employee )
{
var patches = new List<PatchRequest>();
foreach (var evt in employee.PendingEvents)
{
patches.Add(new PatchRequest
{
Type = PatchCommandType.Add,
Name = "Events",
Value = RavenJObject.FromObject(evt, _serializer)
});
}
var localId = $"employees/{employee.Id}";
var addEmployeeEvents = new PatchCommandData()
{
Key = localId,
Patches = patches.ToArray()
};
var updateMetadata = new ScriptedPatchCommandData()
{
Key = localId,
Patch = new ScriptedPatchRequest
{
Script = $"this['@metadata']['{EmployeeEntityVersion}'] = {employee.Version}; "
}
};
_store.DatabaseCommands.Batch(new ICommandData[]
{
addEmployeeEvents,
updateMetadata
});
}
84. Salvar um documento com
eventospublic void Save(Employee employee)
{
var head = GetHead(employee.Id);
var storedVersion = GetStoredVersionOf(head);
if (storedVersion != (employee.Version - employee.PendingEvents.Count()))
throw new InvalidOperationException("Invalid object state.");
if (head == null)
{
SaveNewEmployee(employee);
}
else
{
SaveEmployeeEvents(employee);
}
foreach (var evt in employee.PendingEvents)
Bus.RaiseEvent(evt);
}
85. Carregar um documento com
eventos
public Employee Load(Guid id)
{
EmployeeEvents data;
using (var session = _store.OpenSession())
{
data = session.Load<EmployeeEvents>(id);
}
return new Employee(id, data.Events);
}
public Employee(Guid id,
IEnumerable<IVersionedEvent<Guid>> history)
: this(id)
{
LoadFrom(history);
}
86. Carregar um documento com
eventos
protected void LoadFrom(IEnumerable<IVersionedEvent<TId>> pastEvents)
{
foreach (var e in pastEvents)
{
_handlers[e.GetType()].Invoke(e);
Version = e.Version;
}
}