Need to pass connection string in code

May 4, 2015 at 9:24 PM
Hi Tom:

Thanks for making VFP EF. It has been a lifesaver.

I don't want to store my VFP database location in app.config, so I modified my .context.tt file to include a new initializer in .context.cs.

I would like to assist you in getting this in the master code. Where is the code that generates the .context.tt when you create a new model? Let me know what I can do to help.

Thanks,

Dennis
Coordinator
May 6, 2015 at 9:31 AM
The VFP EF Provider is unaware of context.tt. That code is part of the Entity Framework source code.
May 6, 2015 at 3:21 PM
Ok, thanks. If anyone wants a copy of this custom context.tt, contact me using the info at http://www.hosenose.net. It's too big to paste here.

I also added this code to my model's DLL to make it easy to construct the connection string:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LOGicModel
{
    public static class GetConnectionString
    {
        public static string Path(string path)
        {
            return string.Format(
                @"metadata=res://*/LOGicModel.csdl|res://*/LOGicModel.ssdl|res://*/LOGicModel.msl;provider=VfpEntityFrameworkProvider2;provider connection string=""{0}""",
                path
                );
        }
    }
}