レイヤー間を移動するビジネス レイヤー オブジェクト、ウィジェットがあります。さまざまなレイヤーでさまざまなプロパティのセットを公開したいと考えています。コンパイラがコメントを読み取ると、次のようになります。
//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 ウィジェットがある) を作成する必要がありますか?