9

I'm trying to create C# app under VS 2012 (.NET 4.5) with usage of SqLite managed by EntityFramework 6.0 (also 5.0 was tried out).

My steps were following:

  1. Install sqlite-netFx45-setup-bundle-x86-2012-1.0.85.0.exe from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

    It installs components for VS2012

  2. Create C# project

  3. Using NuGet: Install-Package EntityFramework -Pre (it installs EF 6.0)

  4. Create simple Sqlite DB with one table, which DDL is following:

    CREATE TABLE MyTable (
    Id    INT      PRIMARY KEY,
    Name1 TEXT,
    Name2 VARCHAR,
    Blob1 BLOB,
    Date1 DATE,
    Date2 DATETIME 
    );
    
  5. Add new item to project: ADO.NET Entity Data Model:

  6. Database file mentioned above has been selected, connection string saved in config file

  7. Table is visible in wizard dialog, so I'm checking it and clicking Finish button.

And now code should be generated but instead of that I have following messages:

  • The data type 'longchar' is currently not supported for the target .NET Framework version; the column 'Name1' in table 'main.MyTable' was excluded

  • The data type 'binary' is currently not supported for the target .NET Framework version; the column 'Blob1' in table 'main.MyTable' was excluded.

  • The data type 'date' is currently not supported for the target .NET Framework version; the column 'Date1' in table 'main.MyTable' was excluded.

  • The data type 'date' is currently not supported for the target .NET Framework version; the column 'Date2' in table 'main.MyTable' was excluded.

I quite surprised with that because I have been already using EF + Sqlite but with other provider (legacy 1.0.66.0) and I had no problems with type mapping.

Did you encounter similar problems with mentioned Sqlite version? Do you know some solutions for that problems??

Best regards.

3
  • 1
    There's a similar question with an answer here. You may find it helpful.
    – Sam
    Jun 23, 2013 at 7:29
  • 1
    I found this link, maybe it will help you. CLR Type AND SQL Type Default Mapping
    – trinaldi
    Oct 4, 2013 at 0:13
  • 1
    I went through the same pain for Oracle. What I did was to go with Code First approach and created the configurations manually and I used alternative types for unsupported types
    – Aidin
    Nov 9, 2013 at 1:59

1 Answer 1

0

There seems to be a problem with SqLite version 1.0.85.0 However, version 1.0.84.0 works.

If at all possible, use release 84 in step 1.

(BTW, I just checked their site - 1.0.90.0 is out, you might wanna try that as well)

Side note: if MyTable definitions are not just an example, I would suggest using nvarchar instead of varchar and text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.