I'm trying to dynamically create a connection string during compile time:
private static string m_ConnectionString
{
get
{
string connectionString = @"Data Source=" + myLibrary.common.GetExeDir() + @"\Database\db.sdf;";
return connectionString;
}
}
public static string ConnectionString = m_ConnectionString;
I keep running into type initialization errors. ConnectionString ends up null at runtime. I was trying to avoid having to set the connection string for all applications that use my code library. The location of the database is different for each project that uses the library. I have code that can determine the correction string, but was wanting to run it during class initialization. Is this even possible?