SQLiteConnectionContext クラスに相当する MySQL は何だろうと思っています。プログラムに共通の接続コンテキストを持たせるには、これが必要です。MySQL データベースからデータをプッシュおよびプルするエンティティ ベースのソリューションを作成しています。これを行うためのより良い方法があれば、私もそれを受け入れます。以下は、私が探しているものの SQLite バージョンです。
/// <summary>
/// A ConnectionContext common for all of the Inventory project
/// </summary>
public class InventoryConnectionContext : SQLiteConnectionContext
{
public InventoryConnectionContext(bool connect = true)
: base(InventoryConnectionString, connect)
{
}
/// <summary>
/// Constructs a BudgetConnectionContext and optionally opens the connection
/// </summary>
/// <param name="connectString">Connection string that points to a connection aside from the default connection</param>
/// <param name="connect">Specifies whether or not to open the connection</param>
public InventoryConnectionContext(string connectString, bool connect = true)
: base(connectString)
{
if (connect)
Connect();
}
}