public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ Priority; hashCode = (hashCode * 397) ^ Attempts; hashCode = (hashCode * 397) ^ (LastError != null ? LastError.GetHashCode() : 0); hashCode = (hashCode * 397) ^ RunAt.GetHashCode(); hashCode = (hashCode * 397) ^ SucceededAt.GetHashCode(); hashCode = (hashCode * 397) ^ FailedAt.GetHashCode(); hashCode = (hashCode * 397) ^ LockedAt.GetHashCode(); hashCode = (hashCode * 397) ^ (LockedBy != null ? LockedBy.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode(); hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode(); return(hashCode); } }
public StateSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null) { var stateSet = new StateSet() { CreatedBy = CreatedBy.Clone(), LastUpdatedBy = LastUpdatedBy.Clone(), OwnerOrganization = OwnerOrganization.Clone(), CreationDate = CreationDate, DatabaseName = DatabaseName, Description = Description, EntityType = EntityType, Id = newId ? Guid.NewGuid().ToId() : Id, IsLocked = IsLocked, IsPublic = IsPublic, IsValid = IsValid, Key = Key, LastUpdatedDate = LastUpdatedDate, LockedBy = LockedBy.Clone(), LockedDateStamp = LockedDateStamp, Name = Name, OwnerUser = OwnerUser.Clone(), RequireEnum = RequireEnum, }; if (OwnerUser != null) { stateSet.OwnerUser = user == null?OwnerUser.Clone() : user; } if (IsLocked) { stateSet.LockedBy = user == null?LockedBy.Clone() : user; } foreach (var state in States) { stateSet.States.Add(state.Clone()); } return(stateSet); }
public UnitSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null) { var unitSet = new UnitSet() { CreatedBy = user ?? CreatedBy.Clone(), OwnerOrganization = org ?? OwnerOrganization.Clone(), LastUpdatedBy = user ?? LastUpdatedBy.Clone(), CreationDate = CreationDate, DatabaseName = DatabaseName, Description = Description, EntityType = EntityType, Id = newId ? Guid.NewGuid().ToId() : Id, IsLocked = IsLocked, IsPublic = IsPublic, IsValid = IsValid, Key = Key, LastUpdatedDate = LastUpdatedDate, LockedDateStamp = LockedDateStamp, Name = Name, Notes = CloneNotes(), }; if (OwnerUser != null) { unitSet.OwnerUser = user ?? OwnerUser.Clone(); } if (IsLocked) { unitSet.LockedBy = user ?? LockedBy.Clone(); } foreach (var unit in Units) { unitSet.Units.Add(unit.Clone()); } return(unitSet); }