public void Compose(IServiceRegistry serviceRegistry) { EnsureDatabaseIsInitialized(); serviceRegistry.EnableCQRS(); //serviceRegistry.RegisterQueryHandlers(); serviceRegistry.Register <ICustomerService, CustomerService>(); serviceRegistry.Register <IQueryHandler <CustomersQuery, Customer[]>, CustomersQueryHandler>(); // We register the connection that it is disposed when the scope ends. // The scope here is per web request. serviceRegistry.Register(factory => CreateConnection(), new PerScopeLifetime()); }