示例#1
0
        private void PatchSpeedReadModel(SiteUpdated @event)
        {
            DocumentSession.Patch <SpeedReadModel>(model => model.SiteId == Id)
            .Set(model => model.SiteName, @event.SiteName);

            DocumentSession.Patch <SpeedReadModel>(model => model.SiteId == Id)
            .Set(model => model.SiteLocation, @event.Location);

            DocumentSession.Patch <SpeedReadModel>(model => model.SiteId == Id)
            .Set(model => model.SiteCountryName, @event.CountryName);
        }
        private void PatchSiteSpeeds()
        {
            var speedReadModel = DocumentSession.Load <SpeedReadModel>(Id);

            var siteSpeedModel = new SiteReadModel.SiteSpeedReadModel
            {
                SpeedId             = Id,
                Date                = speedReadModel.Date,
                AircraftName        = speedReadModel.AircraftName,
                PilotName           = speedReadModel.PilotName,
                SpeedInMilesPerHour = speedReadModel.SpeedInMilesPerHour
            };

            DocumentSession.Patch <SiteReadModel>(speedReadModel.SiteId)
            .Append(siteReadModel => siteReadModel.AllVerifiedSpeeds, siteSpeedModel);
        }
        private void PatchAircraftSpeeds()
        {
            var speedReadModel = DocumentSession.Load <SpeedReadModel>(Id);

            var aircraftSpeedModel = new AircraftReadModel.AircraftSpeedReadModel
            {
                SpeedId             = Id,
                Date                = speedReadModel.Date,
                PilotName           = speedReadModel.PilotName,
                SpeedInMilesPerHour = speedReadModel.SpeedInMilesPerHour,
                SiteName            = speedReadModel.SiteName,
                SiteLocation        = speedReadModel.SiteLocation,
                SiteCountryName     = speedReadModel.SiteCountryName,
            };

            DocumentSession.Patch <AircraftReadModel>(speedReadModel.AircraftId)
            .Append(aircraftReadModel => aircraftReadModel.AllVerifiedSpeeds, aircraftSpeedModel);
        }
        private void PatchPersonSpeeds()
        {
            var speedReadModel = DocumentSession.Load <SpeedReadModel>(Id);

            var personSpeedModel = new PersonReadModel.PersonSpeedReadModel
            {
                SpeedId             = Id,
                Date                = speedReadModel.Date,
                AircraftName        = speedReadModel.AircraftName,
                SpeedInMilesPerHour = speedReadModel.SpeedInMilesPerHour,
                SiteName            = speedReadModel.SiteName,
                SiteLocation        = speedReadModel.SiteLocation,
                SiteCountryName     = speedReadModel.SiteCountryName,
            };

            DocumentSession.Patch <PersonReadModel>(speedReadModel.PilotId)
            .Append(personReadModel => personReadModel.AllVerifiedSpeeds, personSpeedModel);
        }
        private void PatchCountrySpeeds()
        {
            var speedReadModel = DocumentSession.Load <SpeedReadModel>(Id);

            var countrySpeedToAdd = new CountryReadModel.CountrySpeedReadModel
            {
                SpeedId             = Id,
                Date                = speedReadModel.Date,
                PilotName           = speedReadModel.PilotName,
                SpeedInMilesPerHour = speedReadModel.SpeedInMilesPerHour,
                SiteName            = speedReadModel.SiteName,
                SiteLocation        = speedReadModel.SiteLocation,
                AircraftName        = speedReadModel.AircraftName,
            };

            DocumentSession.Patch <CountryReadModel>(speedReadModel.CountryId)
            .Append(countryReadModel => countryReadModel.AllVerifiedSpeeds, countrySpeedToAdd);
        }