private static void SetValueIfFound( IObjectVisitorContext <DataConnectionModel, Dictionary <string, string>, object> c) { if (c.ExtendObject.TryGetValue(c.Name, out var stringValue)) { TypeConverter conv = TypeDescriptor.GetConverter(c.PropertyInfo.PropertyType); c.Value = conv.ConvertFrom(stringValue) !; } }
private void CoverSensitiveData(IObjectVisitorContext <UserModel, string> c) { var value = c.Value; if (!string.IsNullOrEmpty(value)) { c.Value = Regex.Replace(value, "(\\d{3})\\d{4}(\\d{4})", "$1****$2"); } if (c.Name == nameof(UserModel.Password)) { c.Value = "***"; } }