public override int GetHashCode() { unchecked { var hashCode = (Previous != null ? Previous.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Next != null ? Next.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsRoot.GetHashCode(); return(hashCode); } }
public bool HavingRight(string permissionCode) { if (IsRoot.Equals(1)) { return(true); } if (Permissions.Any(p => p.Contains(permissionCode))) { return(true); } return(false); }
public override int GetHashCode() { unchecked { int hash = 17; hash = (hash * 34) + Name.GetHashCode(); hash = (hash * 23) + Depth.GetHashCode(); hash = (hash * 23) + IsRoot.GetHashCode(); hash = (hash * 23) + IsLeaf.GetHashCode(); return(hash); } }
public override int GetHashCode() { unchecked { var hashCode = (RecordsStrings != null ? RecordsStrings.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); hashCode = (hashCode * 397) ^ IsRoot.GetHashCode(); hashCode = (hashCode * 397) ^ (Terms != null ? Terms.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Messages != null ? Messages.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { int HashCode = ZValue; HashCode = (HashCode * 397) ^ IsRoot.GetHashCode(); HashCode = (HashCode * 397) ^ (Controls?.GetHashCode() ?? 0); HashCode = (HashCode * 397) ^ (Parent?.GetHashCode() ?? 0); HashCode = (HashCode * 397) ^ (int)MadeOf; HashCode = (HashCode * 397) ^ (Name?.GetHashCode() ?? 0); HashCode = (HashCode * 397) ^ IsPassable.GetHashCode(); HashCode = (HashCode * 397) ^ (Bounds?.GetHashCode() ?? 0); HashCode = (HashCode * 397) ^ (Rand?.GetHashCode() ?? 0); return(HashCode); } }
public virtual IElement Rename(String name) { IsRoot.AssertFalse(); (VPath + name).AssertNotNull(); using (Vault.ExposeReadOnly()) { var oldName = Name; var corrId = Guid.Empty; if (name != oldName) { corrId = BoundVault.ReportChanging(EventReason.Rename, this, oldName, name); } if (name != oldName) { using (Vault.ExposeReadWrite()) { Name = name; var index = Parent == null ? null : Parent.Children as IndexedNodeCollection; if (index != null) { index.Reindex(this); } } } // do not insert the check "Name == name" here // it will break branch name changes propagation // i.e. if a parent has been renamed, all his children should get // the _saveMyNamePlease flag since their position @ the physical storage has changed _saveMyNamePlease = true; if (name != oldName) { (corrId != Guid.Empty).AssertTrue(); BoundVault.ReportChanged(corrId, EventReason.Rename, this, oldName, name); } return(this); } }
/// <summary> /// Constructs the timed scope correlation data /// </summary> /// <returns>Correlation data</returns> private CorrelationData ConstructCorrelationDataEntries(IMachineInformation machineInformation) { CorrelationData correlationData = TimedScopeData; CorrelationData scopeData = TimedScopeData.Clone(); scopeData.AddData(TimedScopeDataKeys.InternalOnly.ScopeName, Name); scopeData.AddData(TimedScopeDataKeys.InternalOnly.InstanceId, InstanceId.ToString()); scopeData.AddData(TimedScopeDataKeys.InternalOnly.IsSuccessful, IsSuccessful.HasValue ? IsSuccessful.Value.ToString() : bool.FalseString); scopeData.AddData(TimedScopeDataKeys.InternalOnly.IsRoot, IsRoot.ToString()); scopeData.AddData(TimedScopeDataKeys.InternalOnly.ScopeResult, Result.ToString()); bool isFailed = !IsSuccessful ?? false; if (isFailed && FailureDescription != null) { scopeData.AddData(TimedScopeDataKeys.InternalOnly.FailureDescription, FailureDescription.ToString()); } scopeData.AddData(TimedScopeDataKeys.InternalOnly.Duration, DurationInMilliseconds.ToString(CultureInfo.InvariantCulture)); long sequenceNumber = correlationData == null ? 0 : correlationData.NextEventSequenceNumber(); scopeData.AddData(TimedScopeDataKeys.InternalOnly.SequenceNumber, sequenceNumber.ToString(CultureInfo.InvariantCulture)); scopeData.AddData(TimedScopeDataKeys.InternalOnly.CallDepth, correlationData == null ? "0" : correlationData.CallDepth.ToString(CultureInfo.InvariantCulture)); IMachineInformation machineInfo = machineInformation; if (machineInfo != null) { scopeData.AddData(TimedScopeDataKeys.InternalOnly.MachineId, machineInfo.MachineId); scopeData.AddData(TimedScopeDataKeys.InternalOnly.MachineCluster, machineInfo.MachineCluster); scopeData.AddData(TimedScopeDataKeys.InternalOnly.MachineRole, machineInfo.MachineRole); scopeData.AddData(TimedScopeDataKeys.InternalOnly.AgentName, machineInfo.AgentName); } // if the user hash has been set, add it to the scope data if (!string.IsNullOrWhiteSpace(m_userHashOverride)) { ULSLogging.LogTraceTag(0x23817500 /* tag_96xua */, Categories.TimingGeneral, Levels.Verbose, "Overriding user hash metadata in the Timed Scope '{0}' with value '{1}'", Name, m_userHashOverride); scopeData.AddData(TimedScopeDataKeys.InternalOnly.UserHash, m_userHashOverride); } else if (correlationData != null && !string.IsNullOrWhiteSpace(correlationData.UserHash)) { scopeData.AddData(TimedScopeDataKeys.InternalOnly.UserHash, correlationData.UserHash); } // capture performance metrics if (PerfDiagnostics != null && PerfDiagnostics.LastStatus) { scopeData.AddData(TimedScopeDataKeys.InternalOnly.CpuCycles, PerfDiagnostics.CyclesUsed.ToString(CultureInfo.InvariantCulture)); scopeData.AddData(TimedScopeDataKeys.InternalOnly.UserModeDuration, PerfDiagnostics.UserModeMilliseconds.ToString(CultureInfo.InvariantCulture)); scopeData.AddData(TimedScopeDataKeys.InternalOnly.KernelModeDuration, PerfDiagnostics.KernelModeMilliseconds.ToString(CultureInfo.InvariantCulture)); scopeData.AddData(TimedScopeDataKeys.InternalOnly.HttpRequestCount, PerfDiagnostics.HttpRequestCount.ToString(CultureInfo.InvariantCulture)); scopeData.AddData(TimedScopeDataKeys.InternalOnly.ServiceCallCount, PerfDiagnostics.ServiceCallCount.ToString(CultureInfo.InvariantCulture)); } return(scopeData); }