Entity Framework 6 连接Sqlite数据库遇到的问题

项目中有用到EF6,使用过程中遇到了点问题,记录一下,希望给有需要的同学一点帮助

至于怎么用ef 网上有很多教程 在此不再赘述

1、问题一

获取Nuget包后,导入数据库,编译

提示Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. Make sure that the ADO.NET provider is installed or registered in the application 

是由于在App.config文件中的DbProviderFactories标签中缺少System.Data.SQLite的声明  增加后如下:

 
    
      
      
      
      

    
  

2、问题二

在App.config文件中命名有connection标签并且路径正确却提示
No connection string named 'DataBaseEntities' could be found in the application config file.
是由于你可能有多个工程,但是在Startup工程的App.config文件中缺少connection标签或者路径不正确

3、问题三

提示

The provider did not return a providermanifesttoken string ASP.NET

可能是由于多个工程中的Entity Framework  或者 SQlite的库版本不统一  不是最近版本, 我遇到的是这样

如果大家有别的问题可以去StackOverFlow上找一找



你可能感兴趣的:(c#)