piątek, 28 grudnia 2012

SQLite + Entity Framework
Recently I was working under new tool. I required to work with small database. I decided to use very simple solution - entity framework with SQLite database. Unfortunately i couldn't use config file to configure connection. So I had first crack at initialize db connection for entity framework from code. Working result you can see below:

EntityConnectionStringBuilder conn = new EntityConnectionStringBuilder();
conn.Metadata = @"res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl";
conn.Provider = "System.Data.SQLite";
conn.ProviderConnectionString = @"data source=mySampeDataBase.db;;password=xxxxx";
EntityConnection entity = new EntityConnection(conn.ConnectionString);