コード例 #1
0
 public MeteringPoint(GsrnNumber gsrnNumber, MeteringPointType meteringPointType)
 {
     GsrnNumber         = gsrnNumber;
     _meteringPointType = meteringPointType;
     _physicalState     = PhysicalState.New;
     AddDomainEvent(new MeteringPointCreated(GsrnNumber, _meteringPointType));
 }
コード例 #2
0
 public void CloseDown()
 {
     if (_physicalState != PhysicalState.ClosedDown)
     {
         _physicalState = PhysicalState.ClosedDown;
         AddDomainEvent(new MeteringPointClosedDown(GsrnNumber));
     }
 }
コード例 #3
0
 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;
 }
コード例 #4
0
        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)));
        }