私はレイヤー間を移動するビジネスレイヤーオブジェクト、ウィジェットを持っています。私は別のレイヤーに異なるプロパティのセットを公開したい。ここでコンパイラはコメントを読めば、それがどのように見えるかです:アセンブリによるアクセスではなくレイヤーによるアクセシビリティ
//bl.dll
public abstract class Widget
{
//repo only
internal virtual Ppty_A {get;set;} //internal to implementation assembly of repo
//repo and service only
internal virtual Ppty_B {get;set;} //internal to implementation assemblies of repo/svc
//everyone inlcuding presentation
public virtual Ppty_C {get;set;}
}
public interface IWidgetService
{ ... } }
public interface IWidgetRepo
{ ... }
public class SimpleWidgetService : IWidgetService
{ ... }
//dal.dll
using bl;
public WidgetRepo
{ ... }
//presentation.dll
using bl;
public WidgetController
{
public WidgetController(IWidgetService ...)
...
}
私の考えでは(私はまだこれをテストしていないと、それは半分しか問題を解決)これを行うことです。
//bl.dll
public abstract class Widget
{
//repo only simply can't be defined in the abstraction -- can't see you => no contract
//repo and service only has to be public?
public virtual Ppty_B {get;set;}
//at least public is public...
public virtual Ppty_C {get;set;}
}
//dal.dll
using bl;
public SQLWidget : Widget //Or actually DALBLWidget -- see below?
{
//repo only
internal ...
internal ...
//the rest
...
}
なら私はちょうど別の抽象ウィジェットを作成する(DAL-BLウィジェットとBL-UIウィジェットを持つ)か?
なぜこのデザインが必要ですか?カスタムレイヤーの各レイヤーにDTOを作成し、必要なデータだけを渡す方が良いアイデアではないでしょうか? –
私は変更を加えなければならないときに、痛みを伴わずに "列"全体を更新する良い選択肢は知らない。私の直感は、同じエンティティを表す型の数を最小限に抑えることです(私はORMのためだけにもう1つ必要があります) –
列全体を更新することはどういう意味ですか? –