简体   繁体   English

SqLite + EntityFramework 5/6不受支持的类型映射

[英]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: 我的步骤如下:

  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 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安装组件

  2. Create C# project 创建C#项目

  3. Using NuGet: Install-Package EntityFramework -Pre (it installs EF 6.0) 使用NuGet:Install-Package EntityFramework -Pre(安装EF 6.0)
  4. 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 ); 
  5. Add new item to project: ADO.NET Entity Data Model: 向项目添加新项:ADO.NET实体数据模型:
  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; 目标.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而不是varchartext

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 缺少类型映射配置或不受支持的映射AutoMapper - Missing Type Map Configuration Or Unsupported Mapping AutoMapper Automapper:缺少类型映射配置或不受支持的映射 - Automapper: Missing type map configuration or unsupported mapping IdentityRole 上缺少类型映射配置或不受支持的映射 - Missing type map configuration or unsupported mapping on IdentityRole AutoMapperMappingException - 缺少类型映射配置或不支持的映射 - AutoMapperMappingException - Missing type map configuration or unsupported mapping 缺少类型映射配置或不支持的映射 - Missing type map configuration or unsupported mapping Automapper:“缺少类型映射配置或不受支持的映射” - Automapper: “Missing type map configuration or unsupported mapping” 注册映射时缺少类型映射配置或不支持的映射 - Missing type map configuration or unsupported mapping when mapping is registered EntityFramework-每种类型的表(TPT)继承和与CodeFirst的映射关系 - EntityFramework - Table per Type (TPT) Inheritance and Mapping Relationships with CodeFirst 具有动态类型的AutoMapper:缺少类型映射配置或不支持的映射 - AutoMapper with dynamic type: Missing type map configuration or unsupported mapping ForeignKey Mapping不适用于EntityFramework 5 - ForeignKey Mapping not working on EntityFramework 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM