protected override Prosumer ProvidePrivateProfile([NotNull] ProviderParameterDto ppdto)
        {
            BuildingInfrastructure be = (BuildingInfrastructure)ppdto.HouseComponent;

            if (be.HouseComponentType == HouseComponentType.Infrastructure)
            {
                Hausanschluss ha = _dbDto.Hausanschlusse.Single(x => x.Guid == be.HausAnschlussGuid);
                var           pa = new Prosumer(be.HouseGuid,
                                                be.Standort ?? "nameless house infrastructure",
                                                be.HouseComponentType,
                                                be.SourceGuid,
                                                be.FinalIsn,
                                                be.HausAnschlussGuid,
                                                ha.ObjectID,
                                                GenerationOrLoad.Load,
                                                ha.Trafokreis, Name, "Flat House Infrastructure");
                pa.Profile = Profile.MakeConstantProfile(be.EffectiveEnergyDemand, "Flat House Infrastucture", Profile.ProfileResolution.QuarterHour);
                if (pa.Profile.EnergyOrPower == EnergyOrPower.Power)
                {
                    pa.Profile = pa.Profile.ConvertFromPowerToEnergy();
                }

                pa.SumElectricityPlanned = be.EffectiveEnergyDemand;
                return(pa);
            }
            throw new FlaException("No profile could be created");
        }
        protected override void RunActualProcess()
        {
            var dbHouse = Services.SqlConnectionPreparer.GetDatabaseConnection(Stage.Houses, Constants.PresentSlice);

            dbHouse.RecreateTable <BuildingInfrastructure>();
            //load data
            var potentialBuildingInfrastructures = dbHouse.Fetch <PotentialBuildingInfrastructure>();
            var houses          = dbHouse.Fetch <House>();
            var hausanschlusses = dbHouse.Fetch <Hausanschluss>();

            dbHouse.BeginTransaction();
            int    count       = 0;
            double totalEnergy = 0;

            foreach (var pb in potentialBuildingInfrastructures)
            {
                House         house = houses.Single(x => x.Guid == pb.HouseGuid);
                Hausanschluss ha    = house.GetHausanschlussByIsn(pb.Isns, pb.Standort, hausanschlusses, Services.Logger) ??
                                      throw new FlaException("no hausanschluss");
                if (pb.Isns.Count == 0)
                {
                    throw new FlaException("Not a single isn");
                }

                var bi = new BuildingInfrastructure(pb.Geschäftspartner,
                                                    pb.LowVoltageTotalElectricityDemand,
                                                    pb.HighVoltageTotalElectricityDemand,
                                                    pb.Isns,
                                                    pb.Isns[0],
                                                    pb.HouseGuid,
                                                    ha.Guid,
                                                    pb.Guid,
                                                    pb.Standort,
                                                    pb.Geschäftspartner);
                count++;
                totalEnergy += bi.EffectiveEnergyDemand;
                dbHouse.Save(bi);
            }

            dbHouse.CompleteTransaction();
            Info("Infrastructure: " + count);
            Info("Energy: " + totalEnergy.ToString("N1"));
        }