public virtual void Merge(EntityChangeInfo changeInfo) { foreach (var propertyChange in changeInfo.PropertyChanges) { var existingChange = PropertyChanges.FirstOrDefault(p => p.PropertyName == propertyChange.PropertyName); if (existingChange == null) { PropertyChanges.Add(propertyChange); } else { existingChange.NewValue = propertyChange.NewValue; } } foreach (var extraProperty in changeInfo.ExtraProperties) { var key = extraProperty.Key; if (ExtraProperties.ContainsKey(key)) { key = InternalUtils.AddCounter(key); } ExtraProperties[key] = extraProperty.Value; } }
public IdentitySecurityLog(IGuidGenerator guidGenerator, SecurityLogInfo securityLogInfo) : base(guidGenerator.Create()) { TenantId = securityLogInfo.TenantId; TenantName = securityLogInfo.TenantName.Truncate(IdentitySecurityLogConsts.MaxTenantNameLength); ApplicationName = securityLogInfo.ApplicationName.Truncate(IdentitySecurityLogConsts.MaxApplicationNameLength); Identity = securityLogInfo.Identity.Truncate(IdentitySecurityLogConsts.MaxIdentityLength); Action = securityLogInfo.Action.Truncate(IdentitySecurityLogConsts.MaxActionLength); UserId = securityLogInfo.UserId; UserName = securityLogInfo.UserName.Truncate(IdentitySecurityLogConsts.MaxUserNameLength); CreationTime = securityLogInfo.CreationTime; ClientIpAddress = securityLogInfo.ClientIpAddress.Truncate(IdentitySecurityLogConsts.MaxClientIpAddressLength); ClientId = securityLogInfo.ClientId.Truncate(IdentitySecurityLogConsts.MaxClientIdLength); CorrelationId = securityLogInfo.CorrelationId.Truncate(IdentitySecurityLogConsts.MaxCorrelationIdLength); BrowserInfo = securityLogInfo.BrowserInfo.Truncate(IdentitySecurityLogConsts.MaxBrowserInfoLength); foreach (var property in securityLogInfo.ExtraProperties) { ExtraProperties.Add(property.Key, property.Value); } }
/// <summary> /// /// </summary> /// <returns></returns> public override string ToString() { var sb = new StringBuilder(); sb.AppendLine($"AUDIT LOG:"); sb.AppendLine($"- {"User",-20}: {CurrentUser} "); sb.AppendLine($"- {"ExecutionDuration",-20}: {ExecutionDuration}"); if (ExtraProperties.Any()) { foreach (var property in ExtraProperties) { sb.AppendLine($"- {property.Key,-20}: {property.Value}"); } } if (Actions.Any()) { sb.AppendLine("- Actions:"); foreach (var action in Actions) { sb.AppendLine(action.ToString()); } } if (Exceptions.Any()) { sb.AppendLine("- Exceptions:"); foreach (var exception in Exceptions) { sb.AppendLine($" - {exception.Message}"); sb.AppendLine($" {exception}"); } } return(sb.ToString()); }
public T GetProperty <T>(string property) { if (ExtraProperties.ContainsKey(property)) { return((T)ExtraProperties[property]); } else { return(default(T)); } }
internal IEnumerable <ExtraProperties> GetLogicalChildrenFlattened() { return(GetLogicalChildren() .SelectMany(item => ExtraProperties.Flatten(item) .ToList())); }
get => SafeGet(ExtraProperties, OAuthBase.OAuthCallbackKey);
/// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="name"></param> /// <returns></returns> protected T GetExtraProperty <T>(string name) { return((T)(ExtraProperties.GetOrDefault(name) ?? default(T))); }
public bool TryGetValue(string key, out object value) { if (key == OwinConstants.Version) { value = "1.0"; return(true); } switch (key) { case OwinConstants.RequestProtocol: value = _requestProtocol; return(true); case OwinConstants.CallCancelled: value = _callCancelled; return(true); case OwinConstants.RequestMethod: value = _requestMethod; return(true); case OwinConstants.RequestPathBase: value = _requestPathBase; return(true); case OwinConstants.RequestPath: value = _requestPath; return(true); case OwinConstants.RequestQueryString: value = _requestQueryString; return(true); case OwinConstants.RequestScheme: value = _requestScheme; return(true); case OwinConstants.RequestHeaders: value = _requestHeaders; return(true); case OwinConstants.RequestBody: value = _requestBody; return(true); case OwinConstants.ResponseHeaders: value = _responseHeaders; return(true); case OwinConstants.ResponseStatusCode: value = _responseStatusCode; return(true); case OwinConstants.ResponseBody: value = _responseBody; return(true); default: if (ExtraProperties.TryGetValue(key, out value)) { return(true); } else { return(_hostProperties.TryGetValue(key, out value)); } } }
internal void Freeze() { Warnings = Warnings.ToList().AsReadOnly(); Tanks = Tanks.ToList().AsReadOnly(); ExtraProperties = ExtraProperties.ToList().AsReadOnly(); }