Things6: An XAF , EF Code First, SQLite Starter Project

Time for some heavy debugging.
Ctrl Alt E
Check Common Language Runtime Exceptions
Run

Ah, I need to find out how to get the connectionstring using the name

Trying this ( after referencing system.configuration)


        //public Things6DbContext()
        //	: base("name=ConnectionString") {
        //}

        // now is

`      public Things6DbContext()
            : base(new SQLiteConnection()
            {
                ConnectionString =  System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString
            }, true)
        {   }`

Oh dear, now when I run I get

Exception thrown: 'System.DllNotFoundException' in System.Data.SQLite.dll
Additional information: Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) occurred

Hmm Google?

Yuk!

Looking at the reference I see the path is

D:\dev\Things6\packages\System.Data.SQLite.Core.1.0.109.2\lib\net451\System.Data.SQLite.dll

I decide to try adding the package to the Win project.

Ah, the error has moved on

Lets wrap that in a try catch

    public static class HandyFunctions
    {
        public static void EnsureDatabaseIsCreated()
        {
            try
            {
                using (var db = new Things6DbContext())
                {
                    var info = db.ModulesInfo.FirstOrDefault();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
     
        }
    }