System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: 2bbaf008c2f8362d55e382a1cee2a43799e626bc
Title: in view, if I use nullif funciton the fields is not created in the edmx entity
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: LINQ Resolution: Unable_To_Reproduce
Last Modified: 2013-01-09 02:10:23
Version Found In: 1.0.83.0
User Comments:
anonymous added on 2013-01-03 11:01:12: (text/x-fossil-plain)
I want to use a view, but some field can have a null field, but for the way that EF works, all the fields that can't be null is cosiderated as key in the view. I don't know that.

So in my view, I use the nullif function to convert the field into an empty value, but not null. This works in EF and SQL Server.

But if I create the edmx to use SQLite this field is not created, so the entity that map the view have not this field.

In my view in the SQLite database I have the following:

nullif(0, MachinesTypes.IDType) As IDType



Thanks.

mistachkin added on 2013-01-03 16:39:58: (text/x-fossil-wiki)
<verbatim>
It sounds like you may want to do something like this:

    CREATE TABLE IF NOT EXISTS t1 (x);
    CREATE VIEW IF NOT EXISTS v1 AS SELECT x, coalesce(x, 0) AS y FROM t1;
    INSERT INTO t1 (x) VALUES (NULL);
    INSERT INTO t1 (x) VALUES (1);
    INSERT INTO t1 (x) VALUES (2);
    SELECT * FROM v1;

Which produces the results:

x           y
----------  ----------
NULL        0
1           1
2           2
</verbatim>