[英]Unsupported type mapping for SqLite + EntityFramework 5/6
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). 我正在尝试使用EntityFramework 6.0(也尝试过5.0)管理的SqLite在VS 2012(.NET 4.5)下创建C#应用程序。
My steps were following: 我的步骤如下:
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 从http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki安装sqlite-netFx45-setup-bundle-x86-2012-1.0.85.0.exe
It installs components for VS2012 它为VS2012安装组件
Create C# project 创建C#项目
Create simple Sqlite DB with one table, which DDL is following: 使用一个表创建简单的Sqlite DB,DDL如下:
CREATE TABLE MyTable ( Id INT PRIMARY KEY, Name1 TEXT, Name2 VARCHAR, Blob1 BLOB, Date1 DATE, Date2 DATETIME );
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; 目标.NET Framework版本当前不支持数据类型'longchar'。 the column 'Name1' in table 'main.MyTable' was excluded 表'main.MyTable'中的'Name1'列被排除
The data type 'binary' is currently not supported for the target .NET Framework version; 目标.NET Framework版本当前不支持数据类型“二进制”。 the column 'Blob1' in table 'main.MyTable' was excluded. 表'main.MyTable'中的'Blob1'列被排除。
The data type 'date' is currently not supported for the target .NET Framework version; 目标.NET Framework版本当前不支持数据类型“日期”。 the column 'Date1' in table 'main.MyTable' was excluded. 表'main.MyTable'中的'Date1'列被排除。
The data type 'date' is currently not supported for the target .NET Framework version; 目标.NET Framework版本当前不支持数据类型“日期”。 the column 'Date2' in table 'main.MyTable' was excluded. 表'main.MyTable'中的'Date2'列被排除。
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. 我对此感到非常惊讶,因为我已经在使用EF + Sqlite,但是在其他提供程序(旧版1.0.66.0)中使用,并且类型映射没有问题。
Did you encounter similar problems with mentioned Sqlite version? 您提到的Sqlite版本是否遇到类似的问题? Do you know some solutions for that problems?? 您知道该问题的一些解决方案吗?
Best regards. 最好的祝福。
There seems to be a problem with SqLite version 1.0.85.0 However, version 1.0.84.0 works. SqLite 1.0.85.0版似乎存在问题,但是1.0.84.0版可以工作。
If at all possible, use release 84 in step 1. 如果可能,请在步骤1中使用发行版84。
(BTW, I just checked their site - 1.0.90.0 is out, you might wanna try that as well) (顺便说一句,我刚刚检查了他们的网站-1.0.90.0退出了,您可能也想尝试一下)
Side note: if MyTable definitions are not just an example, I would suggest using nvarchar instead of varchar and text . 旁注:如果MyTable定义不仅是示例,我建议使用nvarchar而不是varchar和text 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.