Quanren Xiong wrote:
>
> I mapped a Sqlite INTEGER field to a C# Nullable<long> property in EF 5.0.
>
> When the field is NULL, Visual Studio throws exception with following
info:
>

The method throwing the exception
(System.Data.SQLite.SQLiteDataReader.GetInt64)
does not attempt to automatically convert NULL to zero.  Instead, it throws
an
exception, which seems to be the correct behavior, given the IDataRecord
interface
semantics (i.e. otherwise, the caller would have no way to know that the
value is
NULL).

For fields that could be NULL, the GetValue method should be used instead.

Alternatively, the IsDBNull method may be called to check if the underlying
column
value is NULL prior to calling one of the strongly typed methods.

However, I'm not sure how to get the Entity Framework to do that.

--
Joe Mistachkin

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to