@@ -1865,7 +1865,7 @@ public void Pluralization_of_collection_navigations_noPluralize()
1865
1865
}
1866
1866
1867
1867
[ ConditionalFact ]
1868
- public void Not_null_bool_column_with_default_value_is_made_nullable ( )
1868
+ public void Not_null_bool_column_with_unparsed_default_value_is_made_nullable ( )
1869
1869
{
1870
1870
var dbModel = new DatabaseModel
1871
1871
{
@@ -1910,6 +1910,60 @@ public void Not_null_bool_column_with_default_value_is_made_nullable()
1910
1910
Assert . Equal ( "Default" , columns . First ( c => c . Name == "NonNullBoolWithDefault" ) [ RelationalAnnotationNames . DefaultValueSql ] ) ;
1911
1911
}
1912
1912
1913
+ [ ConditionalFact ]
1914
+ public void Not_null_bool_column_with_parsed_default_value_is_not_made_nullable ( )
1915
+ {
1916
+ var dbModel = new DatabaseModel
1917
+ {
1918
+ Tables =
1919
+ {
1920
+ new DatabaseTable
1921
+ {
1922
+ Database = Database ,
1923
+ Name = "Table" ,
1924
+ Columns =
1925
+ {
1926
+ IdColumn ,
1927
+ new DatabaseColumn
1928
+ {
1929
+ Table = Table ,
1930
+ Name = "NonNullBoolWithDefault" ,
1931
+ StoreType = "bit" ,
1932
+ DefaultValueSql = "1" ,
1933
+ DefaultValue = true ,
1934
+ IsNullable = false
1935
+ } ,
1936
+ new DatabaseColumn
1937
+ {
1938
+ Table = Table ,
1939
+ Name = "NonNullBoolWithoutDefault" ,
1940
+ StoreType = "bit" ,
1941
+ IsNullable = false
1942
+ }
1943
+ } ,
1944
+ PrimaryKey = IdPrimaryKey
1945
+ }
1946
+ }
1947
+ } ;
1948
+
1949
+ var model = _factory . Create ( dbModel , new ModelReverseEngineerOptions ( ) ) ;
1950
+
1951
+ var columns = model . FindEntityType ( "Table" ) ! . GetProperties ( ) . ToList ( ) ;
1952
+ var columnWithDefault = columns . First ( c => c . Name == "NonNullBoolWithDefault" ) ;
1953
+ var columnWithoutDefault = columns . First ( c => c . Name == "NonNullBoolWithoutDefault" ) ;
1954
+
1955
+ Assert . Equal ( typeof ( bool ) , columnWithoutDefault . ClrType ) ;
1956
+ Assert . False ( columnWithoutDefault . IsNullable ) ;
1957
+ Assert . Equal ( typeof ( bool ) , columnWithDefault . ClrType ) ;
1958
+ Assert . False ( columnWithDefault . IsNullable ) ;
1959
+ Assert . Equal ( "1" , columnWithDefault [ RelationalAnnotationNames . DefaultValueSql ] ) ;
1960
+ Assert . Equal ( true , columnWithDefault [ RelationalAnnotationNames . DefaultValue ] ) ;
1961
+ Assert . Null ( columnWithoutDefault [ RelationalAnnotationNames . DefaultValueSql ] ) ;
1962
+ Assert . Null ( columnWithoutDefault [ RelationalAnnotationNames . DefaultValue ] ) ;
1963
+
1964
+ Assert . Empty ( _reporter . Messages ) ;
1965
+ }
1966
+
1913
1967
[ ConditionalFact ]
1914
1968
public void Nullable_column_with_default_value_sql_does_not_generate_warning ( )
1915
1969
{
0 commit comments