現在、アプリケーションの UI レイヤーは DAL dll に結合されています。Dal は次のように初期化されます。
//Initialize Data Access for AS400
Dal = JDE8Dal.Instance;
Dal.conString = Properties.Settings.Default.conAS400;
DAL はシングルトンとして設計されています。アプリケーションに 1 つのインスタンスを強制するのは良い考えだと思いました。
ダル:
public class JDE8Dal
{
public string conString { get; set; }
private static readonly JDE8Dal _instance = new JDE8Dal();
private JDE8Dal()
{
}
public static JDE8Dal Instance
{
get { return _instance; }
}
// Methods
}
私の BLL は次のようになります。
namespace YLA.Barcode
{
public static class YlaBarcodeUtil
{
public static string LotStripZeroes(string str)
{
var ret = str;
if (str.Trim().StartsWith("00"))
{
ret = YlaGeneralUtilities.StripLeadingNumofChars(str, 2);
}
return ret;
}
}
public class BarcodeBLL
{
//DAL INIT HERE?
}
}
より多くのアプリケーションを構築する必要があるので、3 層アーキテクチャに移行して DDD を読み始める必要があります。
1) BLL で DAL 処理を移動するには? BLL セクションに初期化を追加するだけですか?
2) DAL 設計をシングルトンとして保持する必要がありますか?