public MeteringPoint(GsrnNumber gsrnNumber, MeteringPointType meteringPointType) { GsrnNumber = gsrnNumber; _meteringPointType = meteringPointType; _physicalState = PhysicalState.New; AddDomainEvent(new MeteringPointCreated(GsrnNumber, _meteringPointType)); }
public void CloseDown() { if (_physicalState != PhysicalState.ClosedDown) { _physicalState = PhysicalState.ClosedDown; AddDomainEvent(new MeteringPointClosedDown(GsrnNumber)); } }
private MeteringPoint(GsrnNumber gsrnNumber, MeteringPointType meteringPointType, bool isProductionObligated, List <Relationship> relationships, int id, int version, PhysicalState physicalState) { GsrnNumber = gsrnNumber; _meteringPointType = meteringPointType; _physicalState = physicalState; _isProductionObligated = isProductionObligated; _relationships = relationships; Id = id; Version = version; }
public static MeteringPoint CreateFrom(MeteringPointSnapshot snapshot) { if (snapshot is null) { throw new ArgumentNullException(nameof(snapshot)); } return(new MeteringPoint( GsrnNumber.Create(snapshot.GsrnNumber), MeteringPointType.FromValue <MeteringPointType>(snapshot.MeteringPointType), snapshot.IsProductionObligated, snapshot.Relationships.Select(r => Relationship.CreateFrom(r)).ToList(), snapshot.Id, snapshot.Version, PhysicalState.FromValue <PhysicalState>(snapshot.PhysicalState))); }