static void Main()
{
//use RavenDB Server as an event store and persists the read side (views) also to RavenDB Server
var viewStore = new DocumentStore{ ConnectionStringName = BootStrapper.RavenDbConnectionStringName };
viewStore.Initialize();
//run RavenDB InMemory
//var store = new EmbeddableDocumentStore {RunInMemory = true};
IWindsorContainer container = null;
try
{
container = BootStrapper.BootStrap(viewStore);
var bus = container.Resolve<IBus>();
var aggregateId = Guid.NewGuid();
//create customer (Write/Command)
CreateCustomer(bus, aggregateId);
//Customer relocating (Write/Command)
RelocateCustomer(bus, aggregateId);
//show all customers [in memory] (Read/Query)
ShowCustomerListView(viewStore);
}
catch(System.Net.WebException ex)
{
Console.WriteLine(@"Unable to connect to RavenDB Server. Have you started 'RavenDB\Server\Raven.Server.exe'?");
}
catch (Exception ex)
{
Console.WriteLine("Fehler: " + ex.Message);
}
finally
{
if (container != null) container.Dispose();
}
Console.WriteLine("Press any key to finish.");
Console.ReadLine();
}