ObjectContext ConnectionString Sqlite
Posted
by codegarten
on Stack Overflow
See other posts from Stack Overflow
or by codegarten
Published on 2010-05-18T20:12:28Z
Indexed on
2010/05/18
20:40 UTC
Read the original article
Hit count: 394
I need to connect to a database in Sqlite so i downloaded and installed System.Data.SQLite and with the designer dragged all my tables.
The designer created a .cs file with
public class Entities : ObjectContext
and 3 constructors:
1st
public Entities() : base("name=Entities", "Entities")
this one load the connection string from App.config and works fine.
App.config
<connectionStrings>
<add name="Entities" connectionString="metadata=res://*/Db.TracModel.csdl|res://*/Db.TracModel.ssdl|res://*/Db.TracModel.msl;provider=System.Data.SQLite;provider connection string="data source=C:\Users\Filipe\Desktop\trac.db"" providerName="System.Data.EntityClient" />
</connectionStrings>
2nd
public Entities(string connectionString) : base(connectionString, "Entities")
3rd
public Entities(EntityConnection connection) : base(connection, "Entities")
Here is the problem, i already tried n configuration, already used EntityConnectionStringBuilder to make the connection string with no luck.
Can you please point me in the right direction!?
EDIT(1)
How can i construct a valid connection string?!
© Stack Overflow or respective owner