I need to set a default value for a field in a data model class that is part of an ASP.NET MVC Core web application I am building.
The application is being implemented with soft deletes. That is, the Model Class / DB Table has a field called "Active" it is a boolean / bit that is set to true or false accordingly. i.e. when an item is deleted then its Active value is false / 0. All items are active when created.
I know that it is possible to set the value explicitly in the controller when the data is posted to the "CreateItem" method in the controller but I'd rather not have to do that. Is there a different way? e.g. decorating the field in the Model class with an attribute.