cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Entity Framework Bug: Nullable Bit is not nullable in remote client DB Sql Anywhere

Former Member
0 Kudos
3,514

I'm using

iAnywhere.Data.SQLAnywhere.v4.5, runtime version: v4.0.30319, Version 12.0.1.38734 VisualStudio 2012

When adding a column via Entity Framework:

AddColumn("TableName", "ColumnName", c => c.Boolean(nullable:true));

or

AddColumn("TableName", "ColumnName", c => c.Boolean());

This has a result that a column is created with Type of BIT in the remote client, BUT Unfortunately, the column is not nullable.

This approach DOES work for other types like integer.


Workaround 1. perform following query:

ALTER TABLE TableName ALTER ColumnName NULL

This only works when the table has no data. if it already has data => exception => "Table must be empty"


Workaround 2.

use regular sql instead of EF commands:

alter table TableName add ColumnName bit NULL;

Where do I report this? Anyone seen anything like this before?

Accepted Solutions (0)

Answers (0)