MEF Validation: Warning when using BIT (boolen) with SQL Server

Hi!

I use an SQL Server database. Several tables in my DB contain columns of type "bit" which are set to be NOT NULL. So they have to be 1 or 0.

When creating a Radzen/Blazor application using that database as source everything works fine but I always get a lot of warnings regarding the "bit" columns in my tables:

Category: Microsoft.EntityFrameworkCore.Model.Validation
EventId: 20601
RequestPath: /_blazor

The 'bool' property 'XXXXX' on entity type 'YYYYYY' is configured with a database-generated default. This default will always be used for inserts when the property has the value 'false', since this is the CLR default for the 'bool' type. Consider using the nullable 'bool?' type instead so that the default will only be used for inserts when the property value is 'null'.

Should I define a default value for the "bit" columns in my DB? Using bool? is not an option for me in this case.

Does anyone else have seen this warning? What is the recommend way to fix this?

Thanks a lot!

Joe

Hi @JustJoe,

This seems to be an Entity Framework related issue and you should better search for it online.