in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

invalidcastexception SQLiteConnection to System.Data.SqlClient.SqlConnection

Last post 02-25-2011 1:54 PM by phanton. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-22-2010 8:13 AM

    • martyh
    • Not Ranked
    • Joined on 09-22-2010
    • Posts 1

    invalidcastexception SQLiteConnection to System.Data.SqlClient.SqlConnection

    Hi having some issues getting sqlite working with .net 4 entity framework. I have this in my app.config: I have: System.Data System.Data.Entity System.Data.Linq System.Data.SQLite System.Data.SQLite.Linq However every time I run the tests I'm getting: System.InvalidCastException: Unable to cast object of type 'System.Data.SQLite.SQLiteConnection' to type 'System.Data.SqlClient.SqlConnection'. Any ideas?
  • 02-25-2011 1:54 PM In reply to

    • phanton
    • Not Ranked
    • Joined on 02-24-2011
    • Scotland
    • Posts 1

    Re: invalidcastexception SQLiteConnection to System.Data.SqlClient.SqlConnection

    I had the same issue and found the solution was to change the edmx file directly. At the beginning of the file change the provider to SQLite like this; .... <!-- SSDL content --> <edmx:StorageModels> <Schema Namespace="MyModel.Store" Alias="Self" Provider="System.Data.Sqlite" .... ..... If the field types are compatible then all will work fine. At least it did for me.
    SQLite is awesome
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems