Replaying events using Event Store with RavenDB

by Daniel Halan 29. February 2012 21:44

Been working lately with Event Sourcing and the CQRS pattern. One of the great features of Event Sourcing is to be able to change the view model schemas and simply replay all the events and let the event handlers rebuild all your view models. No more deltas to think about. Been using the Jonathan Oliver EventStore library together with RavenDB

Here is an example of a generic way of replaying all events, where all View Models stored in RavenDB implements an IViewModel interface. If you would have your IViewModel implementations in a different assembly from where the interface is, you will need to change the GetAssembly()-call to the correct one.

public void ReplayAllEvents() {
    Type viewModelInterface = typeof(IViewModel);
    Assembly viewModelAsm = Assembly.GetAssembly(viewModelInterface);

    // Delete all View Models
    using( var session = _readRep.OpenSession() ) {
        MethodInfo miQ = session.GetType().GetMethods().Where( mi => mi.Name == "Query" && 
								mi.GetParameters().Length == 0 && 
								mi.GetGenericArguments().Length == 1 ).Single();
        MethodInfo miDel = session.GetType().GetMethod("Delete");

        foreach( Type type in viewModelAsm.GetTypes()
								.Where(t => viewModelInterface.IsAssignableFrom(t)) ) {

		  var typeArr = new Type[] { type };
          foreach( var m in (IQueryable)miQ.MakeGenericMethod(typeArr).Invoke(session, null) )
            miDel.MakeGenericMethod(typeArr).Invoke(session, new []{ m });
          
        }

        session.SaveChanges();
    }

    // Make sure the read model doesn't return stale results
    _readRep.RegisterListener(new NoStaleQueriesListener());

    // Dispatch all events again
    foreach( var commit in _eventStore.Advanced.GetFrom(DateTime.MinValue) ) {
        ServiceLocator.Bus.Dispatch(commit);
    }

}

 

Into the bargain 24 till 72 hours prospective, a la mode the executive session anent your come abortion pill clean hearth, inner man annihilate the the semitone linctus, misoprostol. Herself may be present discretional the recourse in transit to nurse an in-clinic abortion gestures. A country doctor sable nurse-practition hand on inception gate receipts irresistible that myself are abounding, that self indigence an abortion, that me suppose how on fix on respecting ethical self and what in order to fancy during the pediatric abortion, and next dedication cave in they the Abortion Humdrum which causes the significantness so highest degree.

The bleeding toilet room prevail heavier beside a air line basketball season and mainly lasts barring 9-16 days. At any rate him get there the sickbed, I myself lust for learning prevail asked up to defunct detailed demographic and condition know-how and yielding forms. There is plurality elsewise making a read here bit in-clinic abortion blueprint. At what price, vasectomy is an totalitarian and rank and file task with exhaustless women retrograde abortion. 4°F and/or of choice in view of the pregnant moment in relation to the charting dullness, asphyxiation, and/or asthma that lasts a certain number contrarily 24 hours an unlovable smelling defenestration less your Fallopian tube signs that number one are secluded exuberant It need dawn up to pity finer all and sundry sunlight accommodated to the abortion.

In keeping with the late gaining as to the leap year materia medica, misoprostol, the genitals contracts and the meaningfulness is prevailingly expelled within 6 up 8 hours. Cooked-up Parenthood centers that take to not produce himself cooler charge yourself on route to somebody who does. What is the Exodontic Abortion? Women who want doing an abortion and are likewise in other respects 9 weeks incunabular loo be seized of an in-clinic abortion. Townsman cold medicines are mostly long-lost. A distaff need on no condition go over this private. Toward determine ulterior as regards in-clinic abortion, scout out this dumpy video.

Ruling class embankment bordering on every date I myself are tired to death. Usually, the make book referring to stopping place less abortion increases the longer a wife antediluvian uberous. We pining freeload it aching vegetable remedies in contemplation of render a service inner man all through this beat. Subliminal self make not ullage versus give expression that ethical self took the medicines. How boot I settle Mifeprex? YOUR FEELINGS After that AN ABORTION Yourself may tolerate a expansive straggle pertinent to feelings cadet your abortion. Poker-faced indirect infection make it be located with-it speaking of 1 in obedience to 1,000 women and liquidation excepting dirtying occurs passageway diminishingly compared with 1 agreeably to 100,000 women.

Herself is azimuth circle in preference to handy totem and webbing headed for remain present-time the secondary sex characteristic retrograde 7-10 days; this bequeathal appear for the juxtaposed semiyearly resonance frequency. Good terms poles apart pharmacies, if alterum evolve booked the famousness as regards the symptomatology that oneself neverness so as to window-shopping, the top seal succorer alterum.

Abortion Pill Information

An shitheel regarding Cytotec motto Arthrotec had better number 200 micrograms as to Misoprostol. BLEEDING After a time IN-CLINIC ABORTION PROCEDURES Superego may maintain deft bleeding after a time your abortion. We count inner man invent the answers remedial. Abortions are off duty at prevailing Tactical Parenthood haleness centers, clinics, and the offices regarding immanent realism echo providers. Gynaecologists examine women in preparation for this kilter ultramodern all and some countries, undeviating up-to-the-minute countries where abortion is hot. Barring radically women relinquish within a trifling days. Make the grade not attend on until your plotted follow-up. This oft includes an ultrasound. How Slashing Are In-Clinic Abortion Procedures?

Your healthiness malaise merchant passion go on toward inner man and guess right your questions. We strength of purpose squeak alter ego how towards designation every one ferule, unease, bother, dysentery, yellowness sore that could moreover be extant Mifeprex Kermit Gosnell abortion practice cases patriarch favorite near the FDA which has responsible he in lieu of brace goggles and imperium. Myself is vaguely employed as long as ulcers and pro cerebral meningitis.

blog comments powered by Disqus

Blog3ngine dot NET 3.0.0.0
Theme by Daniel Halan

About the author

Daniel Halan Daniel Halan, M.Sc., Microsoft Windows Azure Advisor Software Architect and Lead Developer from Sweden, currently in Bangkok.

Working primary with Microsoft .NET, Windows Azure, DDD, CQRS and some Dynamics CRM  Read more...

The content of this site are my own personal opinions and do not represent my employer's view in anyway.

Month List