Creating a not-empty GUID validation attribute and a not-default validation attribute

added by DotNetKicks
3/14/2019 12:19:17 PM

1 Kicks, 385 Views

In this post I describe a handy validation attribute used during ASP.NET Core model binding for verifying that a GUID doesn't have the default value of Guid.Empty. I always find myself re-creating it in projects, so now I can just copy it from here! You might be wondering why a "not-empty" attribute is necessary.