コード例 #1
0
 public InstallationDomain Save(InstallationDomain installation)
 {
     if (ExistsById(installation.Id))
     {
         return(installation);
     }
     installation = installation.WithLocation(_locationRepository.Save(installation.Location))
                    .WithAddress(_addressRepository.Save(installation.Address))
                    .WithSponsor(_sponsorRepository.Save(installation.Sponsor));
     return(_connection.Get.InsertOrReplace(InstallationEntity.FromDomain(installation)) > 0 ? installation : null);
 }
コード例 #2
0
        private InstallationDomain FindReferences(InstallationEntity installation)
        {
            if (installation == null)
            {
                return(null);
            }
            var location = _locationRepository.FindById(installation.LocationRef) ?? throw new ArgumentException("Location is null");
            var address  = _addressRepository.FindById(installation.AddressRef) ?? throw new ArgumentException("Address is null");
            var sponsor  = _sponsorRepository.FindById(installation.SponsorRef) ?? throw new ActivationException("Sponsor is null");

            return(installation.toDomain(location, address, sponsor));
        }