public bool Equals(SimpleVariables other) { if (other == null) { return(false); } return(VersionId.Equals(other.VersionId) && LastMissionPassedName.Equals(other.LastMissionPassedName) && MissionPackGame.Equals(other.MissionPackGame) && CurrLevel.Equals(other.CurrLevel) && CameraPosition.Equals(other.CameraPosition) && MillisecondsPerGameMinute.Equals(other.MillisecondsPerGameMinute) && LastClockTick.Equals(other.LastClockTick) && GameClockMonths.Equals(other.GameClockMonths) && GameClockDays.Equals(other.GameClockDays) && GameClockHours.Equals(other.GameClockHours) && GameClockMinutes.Equals(other.GameClockMinutes) && GameClockDayOfWeek.Equals(other.GameClockDayOfWeek) && StoredGameClockMonths.Equals(other.StoredGameClockMonths) && StoredGameClockDays.Equals(other.StoredGameClockDays) && StoredGameClockHours.Equals(other.StoredGameClockHours) && StoredGameClockMinutes.Equals(other.StoredGameClockMinutes) && ClockHasBeenStored.Equals(other.ClockHasBeenStored) && CurrPadMode.Equals(other.CurrPadMode) && HasPlayerCheated.Equals(other.HasPlayerCheated) && TimeInMilliseconds.Equals(other.TimeInMilliseconds) && TimeScale.Equals(other.TimeScale) && TimeStep.Equals(other.TimeStep) && TimeStepNonClipped.Equals(other.TimeStepNonClipped) && FrameCounter.Equals(other.FrameCounter) && OldWeatherType.Equals(other.OldWeatherType) && NewWeatherType.Equals(other.NewWeatherType) && ForcedWeatherType.Equals(other.ForcedWeatherType) && WeatherInterpolation.Equals(other.WeatherInterpolation) && WeatherTypeInList.Equals(other.WeatherTypeInList) && Rain.Equals(other.Rain) && CameraCarZoomIndicator.Equals(other.CameraCarZoomIndicator) && CameraPedZoomIndicator.Equals(other.CameraPedZoomIndicator) && CurrArea.Equals(other.CurrArea) && InvertLook4Pad.Equals(other.InvertLook4Pad) && ExtraColour.Equals(other.ExtraColour) && ExtraColourOn.Equals(other.ExtraColourOn) && ExtraColourInterpolation.Equals(other.ExtraColourInterpolation) && ExtraColourWeatherType.Equals(other.ExtraColourWeatherType) && WaterConfiguration.Equals(other.WaterConfiguration) && LARiots.Equals(other.LARiots) && LARiotsNoPoliceCars.Equals(other.LARiotsNoPoliceCars) && MaximumWantedLevel.Equals(other.MaximumWantedLevel) && MaximumChaosLevel.Equals(other.MaximumChaosLevel) && GermanGame.Equals(other.GermanGame) && FrenchGame.Equals(other.FrenchGame) && NastyGame.Equals(other.NastyGame) && CinematicCamMessagesLeftToDisplay.Equals(other.CinematicCamMessagesLeftToDisplay) && TimeLastSaved.Equals(other.TimeLastSaved) && TargetMarkerHandle.Equals(other.TargetMarkerHandle) && HasDisplayedPlayerQuitEnterCarHelpText.Equals(other.HasDisplayedPlayerQuitEnterCarHelpText) && AllTaxisHaveNitro.Equals(other.AllTaxisHaveNitro) && ProstiutesPayYou.Equals(other.ProstiutesPayYou)); }
private UserAddedEvent(EntityId clientId, Name name, Email mail, VersionId version) : base(DateTime.Now, version) { Id = clientId; Name = name; Mail = mail; }
public void BusinessEntityNotIsNew() { var buUpdated = BusinessEntity.From(EntityTestId.GetNext(), VersionId.Next(VersionId.New())); var isNew = new BusinessEntityIsNew(); Assert.False(isNew.IsSatisfiedBy(buUpdated)); }
public override int GetHashCode() { int hash = 1; if (Target.Length != 0) { hash ^= Target.GetHashCode(); } if (Type != global::Google.Cloud.Functions.V1.OperationType.OperationUnspecified) { hash ^= Type.GetHashCode(); } if (request_ != null) { hash ^= Request.GetHashCode(); } if (VersionId != 0L) { hash ^= VersionId.GetHashCode(); } if (updateTime_ != null) { hash ^= UpdateTime.GetHashCode(); } if (BuildId.Length != 0) { hash ^= BuildId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
protected override Task <CommandResult <Guid> > ExecuteCommand(UpdateEntityCommand command, CancellationToken cancellationToken) { var agg = _aggregateFactory.Create( EventStream <EntityTestId> .From(EntityTestId.Empty(), new AggregationName(), VersionId.Empty(), new ImmutableArray <IDomainEvent>()) ); var isSucceed = agg.IsValid; var okId = Guid.Empty; if (isSucceed) { agg.UpdateName(EntityTestId.From(command.AggregateId), Name.From(command.Name)); isSucceed = agg.IsValid; agg.GetEvents().ToImmutableList() .ForEach(ev => Publisher.Publish(ev)); okId = agg.GetChange().AggregationId.Value; } return(Task.FromResult(new CommandResult <Guid>(isSucceed, okId, agg.Failures))); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, $"{{0}}{{1}}{ StringHelper.StringFormatSequence(2, 20, Configuration.FieldSeparator) }", Id, FieldSeparator, EncodingCharacters, SendingApplication?.ToDelimitedString(), SendingFacility?.ToDelimitedString(), ReceivingApplication?.ToDelimitedString(), ReceivingFacility?.ToDelimitedString(), DateTimeOfMessage.HasValue ? DateTimeOfMessage.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, Security, MessageType?.ToDelimitedString(), MessageControlId, ProcessingId?.ToDelimitedString(), VersionId?.ToDelimitedString(), SequenceNumber.HasValue ? SequenceNumber.Value.ToString(Consts.NumericFormat, culture) : null, ContinuationPointer, AcceptAcknowledgmentType, ApplicationAcknowledgmentType, CountryCode, CharacterSet != null ? string.Join(Configuration.FieldRepeatSeparator, CharacterSet) : null, PrincipalLanguageOfMessage?.ToDelimitedString(), AlternateCharacterSetHandlingScheme, MessageProfileIdentifier != null ? string.Join(Configuration.FieldRepeatSeparator, MessageProfileIdentifier.Select(x => x.ToDelimitedString())) : null ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public ProcessShipmentRequest() { TransactionDetail = new TransactionDetail { CustomerTransactionId = "***Ship Request***" }; Version = new VersionId(); }
public User(UserId clientId, Name name, VersionId version) : base(clientId, version) { Name = name; AppendValidationResult(name.ValidationStatus.Errors.ToImmutableList()); }
public override int GetHashCode() { unchecked { return((Id.GetHashCode() * 397) ^ (VersionId?.GetHashCode() ?? 0)); } }
public static UserAggregationRoot ReconstructFrom(User currentState) { var nextVersion = currentState.IsValid? VersionId.Next(currentState.Version):currentState.Version; var user = User.From(currentState.Identity, currentState.Name, nextVersion); return(new UserAggregationRoot(user)); }
public void Version_get_gr_and_lt() { var version = VersionId.From(1); var next = VersionId.Next(version); Assert.True(version < next); Assert.True(next > version); }
public void Version_get_next() { var version = VersionId.New(); var next = VersionId.Next(version); var nextCheck = version.Value + 1; Assert.Equal(next.Value, nextCheck); }
protected EventBasedAggregationRoot(TEntityId aggregateId, VersionId version, AggregationName name) { Name = name; AggregateId = aggregateId; Version = version; _currentStream = new List <IDomainEvent>(); _changes = new List <IDomainEvent>(); }
public void Aggregate_reconstruct_a_valid() { var be = BusinessEntity.From(EntityTestId.GetNext(), VersionId.New()); var factory = new ObjectBasedAggregateFactory(); var agg = factory.Create(be); Assert.True(agg.IsValid); }
private User(EntityId clientId, Name name, Email commercialEmail, VersionId version) : base(clientId, version) { Name = name; Mail = commercialEmail; AppendValidationResult(Identity.ValidationStatus.Failures); AppendValidationResult(Name.ValidationStatus.Failures); AppendValidationResult(Mail.ValidationStatus.Failures); }
public VersionId_I NewVersionId() { var id = new VersionId() { }; XIdentification.IssueId(id); return(id); }
public void Version_create_a_valid_from() { var fixture = new Fixture(); var input = fixture.Create <int>(); fixture.Register <VersionId>(() => VersionId.From(input)); var version = fixture.Create <VersionId>(); Assert.Equal(input, version.Value); }
public RateRequest() { _shipmentRate = new List <EisShipmentRate>(); TransactionDetail = new TransactionDetail { CustomerTransactionId = "***Rate Request***" }; ReturnTransitAndCommit = true; ReturnTransitAndCommitSpecified = true; Version = new VersionId(); }
/// <summary> /// Return a JSON representation of this object. /// </summary> /// <param name="CustomVersionDetailSerializer">A delegate to serialize custom version detail JSON objects.</param> public JObject ToJSON(CustomJObjectSerializerDelegate <VersionDetail> CustomVersionDetailSerializer = null) { var JSON = JSONObject.Create( new JProperty("version", VersionId.ToString()), new JProperty("endpoints", new JArray(Endpoints.SafeSelect(endpoint => endpoint.ToJSON()))) ); return(CustomVersionDetailSerializer != null ? CustomVersionDetailSerializer(this, JSON) : JSON); }
public void Remove(User entity) { var oldState = Get(entity.Identity); if (VersionId.Next(oldState.Version) > entity.Version) { throw new DbUpdateConcurrencyException("This version is not the most updated for this object."); } var entry = entity.ToUserState(); DbContext.Users.Remove(entry); }
internal EventStreamBusinessEntityAggregateRoot(Name name, Email email, VersionId version) : base(EntityTestId.GetNext(), version, AggregationName.From(nameof(EventStreamBusinessEntityAggregateRoot))) { if (name.ValidationStatus.IsValid && email.ValidationStatus.IsValid) { var change = TestEntityAggregateAddedDomainEvent.From(AggregateId, name, email, version); Apply(change); // it is always new Raise(change); } AppendValidationResult(name.ValidationStatus.Failures); AppendValidationResult(email.ValidationStatus.Failures); }
/// <summary> /// Returns true if ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties instances are equal /// </summary> /// <param name="other">Instance of ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComAdobeCqSocialDatastoreAsImplASResourceProviderFactoryProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( VersionId == other.VersionId || VersionId != null && VersionId.Equals(other.VersionId) ) && ( CacheOn == other.CacheOn || CacheOn != null && CacheOn.Equals(other.CacheOn) ) && ( ConcurrencyLevel == other.ConcurrencyLevel || ConcurrencyLevel != null && ConcurrencyLevel.Equals(other.ConcurrencyLevel) ) && ( CacheStartSize == other.CacheStartSize || CacheStartSize != null && CacheStartSize.Equals(other.CacheStartSize) ) && ( CacheTtl == other.CacheTtl || CacheTtl != null && CacheTtl.Equals(other.CacheTtl) ) && ( CacheSize == other.CacheSize || CacheSize != null && CacheSize.Equals(other.CacheSize) ) && ( TimeLimit == other.TimeLimit || TimeLimit != null && TimeLimit.Equals(other.TimeLimit) )); }
public void Add(User entity) { var entry = entity.ToUserState(); var oldState = Get(entity.Identity); if (oldState.Equals(User.Empty())) { DbContext.Users.Add(entry); } else { if (VersionId.Next(oldState.Version) > entity.Version) { throw new DbUpdateConcurrencyException("This version is not the most updated for this object."); } DbContext.Entry(oldState).CurrentValues.SetValues(entry); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (VersionId != null) { hashCode = hashCode * 59 + VersionId.GetHashCode(); } if (CacheOn != null) { hashCode = hashCode * 59 + CacheOn.GetHashCode(); } if (ConcurrencyLevel != null) { hashCode = hashCode * 59 + ConcurrencyLevel.GetHashCode(); } if (CacheStartSize != null) { hashCode = hashCode * 59 + CacheStartSize.GetHashCode(); } if (CacheTtl != null) { hashCode = hashCode * 59 + CacheTtl.GetHashCode(); } if (CacheSize != null) { hashCode = hashCode * 59 + CacheSize.GetHashCode(); } if (TimeLimit != null) { hashCode = hashCode * 59 + TimeLimit.GetHashCode(); } return(hashCode); } }
protected DomainEvent(DateTime when, VersionId version) { When = when; Version = version; }
public static User Empty() { return(From(EntityId.Empty(), Name.Empty(), Email.Empty(), VersionId.Empty())); }
public static User From(EntityId clientId, Name name, Email commercialEmail, VersionId version) { var user = new User(clientId, name, commercialEmail, version); return(user); }
public EventStreamBusinessEntityAggregateRoot Create(AddEntityCommand command) { return(new EventStreamBusinessEntityAggregateRoot(command.Name, command.Mail, VersionId.New())); }
public static User ToUser(this UserState state) => User.From( UserId.From(state.Id), Name.From(state.Name), VersionId.From(BitConverter.ToInt32(state.RowVersion)));
protected AggregateAddedDomainEvent(TEntityId aggregateId, VersionId version) : base(DateTime.Now, version) { AggregateId = aggregateId; }