I have this attribute
[AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = false)]
public class IgnoreAttribute : Attribute
{
}
I want to add this attribute to some classes or properties to replace the value of that property or class with something like null
or default()
in a middleware.
Like this
public class Login
{
[Ignore]
public string UserName { get; set; }
[Ignore]
public string Password { get; set; }
}
Based on https://stackoverflow.com/a/2282254/9995067 and https://stackoverflow.com/a/44500627/9995067 If I want to check the properties that have that specific attribute I need to know the type of the object and in the middleware I have access to HttpContext request and response body. The Request and Response model can be anything. How can I handle that?