0
当下面的代码运行System.InvalidCastException,实体框架与TINYINT标识列
var op = context.Operation.SingleOrDefault(x => x.Operation1 == null);
我得到一个错误
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Specified cast is not valid.
Source=System.Data
StackTrace:
at System.Data.SqlClient.SqlBuffer.get_Byte()
InnerException:
我注意到,EF 6.1.3已经映射到的列运行到名称Operation1,因为该表也称为操作
表结构有
[OperationID] [tinyint] IDENTITY(1,1) NOT NULL,
[Operation] [varchar](255) NULL
什么是EF可以使用的最小数字整数类型? –
http://stackoverflow.com/questions/12202203/using-byte-as-the-primary-key-datatype –
我发现在表中的shortint和字节类型之间有一个连接,在另一个表结构中。我猜这可能与它有关。 –