내가 과거에 제기 된 세션 관리의 문제를 알고 있지만 나는 내 문제를 극복하는 데 도움이 아무것도 찾을 수 없습니다 .. 캐슬 윈저를 통해 해결 한 저장소 클래스 (예 : CustomerRepository, ProductRepository 등) (참고 : here의 설명과 같이 세 가지 호출 패턴을 적용하려고합니다). 나는 내가 Presenter 당 세션을 가질 것이라고 생각한다. (제 경우에는 이것은 폼 당 하나의 세션과 동일하다.) 그러나 저장소 클래스는 현재 활성화 된 폼에 대한 세션에 액세스해야한다. 나는 이것을 어떻게 통합하는지 잘 모르겠다. 발표자는 싱글이 아니기 때문에 이러한 저장소가, 윈저 통해 해결하고 있다는 사실 .. 예를 들어NHibernate에, 윈폼, 성 윈저 : 세션 관리</p> <p>나는의 번호를 가지고
로 :
public class SomePresenter
{
private ISomeView view;
private ISession session;
private ICustomerRepository customerRepository;
private IOrderRepository orderRepository;
public SomePresenter(ISomeView view, ISessionFactory sessionFactory, ICustomerRepository customerRepository, IOrderRepository orderRepository)
{
this.view = view;
this.session = sessionFactory.OpenSession();
this.customerRepository = customerRepository;
this.orderRepository = orderRepository;
}
}
레포지토리 세션에 액세스해야 ... 이걸 어떻게 사용 윈저 가야합니까 ? 속성을 통해 리포지토리에 세션을 수동으로 설정해야합니까? 아니면 익숙하지 않은 영리한 Windsor 트릭이 있습니까?
레코드의 경우 현재 접근 방식 이외의 제안을 열어 두었습니다. –