さまざまなテーブルのクエリを生成するためのクラスを作成しています。各テーブルには独自のクラスがあります。MetaTable と呼ばれるテーブルのクラスは次のようになります
public class MetaTableQueryCreator
{
public int userID { get; set; }
public int CategoryID { get; set; }
public string Tags { get; set; }
public string FilePath_Pk {get;set;}
public MetaTableQueryCreator()
{
userID = 0;
CategoryID = -1;
Tags = string.Empty;
}
public string GetInsertQuery()
{
string query = string.Empty;
if(!String.IsNullOrEmpty(FilePath_Pk))
{
// query = @"INSERT INTO MetaTable VALUES('" + userId + "', 1,'','','','','','','" + input + "','','','')";
}
else
{
}
return query;
}
public string GetDeleteQuery()
{
string query = string.Empty;
if (!String.IsNullOrEmpty(FilePath_Pk))
{
// query = @"INSERT INTO MetaTable VALUES('" + userId + "', 1,'','','','','','','" + input + "','','','')";
}
return query;
}
public string GetUpdateQuery()
{
string query = string.Empty;
if (!String.IsNullOrEmpty(FilePath_Pk))
{
//query = @"INSERT INTO MetaTable VALUES('" + userId + "', 1,'','','','','','','" + input + "','','','')";
}
return query;
}
}
アプリケーションで MEF を使用しているため、これらすべてのクエリ ジェネレーター クラスの基本クラスを作成する必要があります。基本クラスの作成中に次の問題を解決する必要があります
1)各クラスのテーブルのフィールドに対応するプロパティがあります。クラスごとに個別のプロパティ セット (フィールドに対応) があるため、これらすべてのプロパティを基本クラスに配置することはできません。MEF を使用しているため、基本クラスで定義されたプロパティにのみアクセスできます。メインプログラム。どうすればこの問題を解決できますか? この問題のためのより良いアーキテクチャはありますか?