Closed grosch closed 3 years ago
Hey. Thanks! Nothing automatically triggers the mutation. The mutation needs to be hooked into the process of your choosing. I would expect people to normally mutate before saving to model to the database or before validating data. Here is an example code block.
public partial class ApplicationUser
{
[ToLower, RegexReplace(@"[^a-z0-9_]")]
public virtual string UserName { get; set; }
}
var user = new ApplicationUser() {
UserName = "M@X_speed.01!"
}
// Then to perform mutation
new MutationContext<ApplicationUser>(user).Mutate();
This is a pretty cool library, thanks! What's not clear to me though is, what actually triggers the mutation since this isn't a normal ability of an
Attribute
.