티스토리 뷰

IoC(Inversion of Control)?
 IoC는 응용프로그램의 구성 요소들을 다른 구성 요소들과 분리할 수 있게 도와주는 소프트웨어 설계 패턴이다.

 IoC 컨테이너는 구성 요소의 인스턴스를 생성할 때마다 자동적으로 해당 구성 요소의 의존성을 해석한다.
그 결과 만약 컨트롤러가 어떤 의존성을 가지고 있다면 IoC 컨테이너가 적절한 인스턴스를 제공해 주게 될 것이다.

이 작업은 구성 요소들 간의 의존성을 자연스럽게 분리해 주고, 더 약한 결합의 아키텍처를 지원하여 단위 테스트를 더 쉽게
만들어 줄것이다.


캐슬 윈저?
 캐슬 윈저는 IoC컨테이너로 ASP.NET MVC에서 잘 작동한다.
 추상 형식(인터페이스)과 특정 구체 형식을 매핑하는 구성을 제공하고 그 후 누군가가 
 myWindosorInstance.Resolve<ISomeAbstractType>()를 호출한다면 캐슬 윈저는 현재 구성되어 있는 것과 일치하는
 구체 형식의 모든 의존성 체인을 분석하면서 구성 요소의 생명주기를 고려하여 인스턴스를 생성한 후 반환할 것이다.


.NET MVC을 위한 캐슬 윈저 다운로드
http://castleproject.org/castle/download.html
.NET MVC에서 캐슬 윈저 적용하기.
http://docs.castleproject.org/Windsor.Windsor-tutorial-ASP-NET-MVC-3-application-To-be-Seen.ashx

참조]

Introduction

This is introductory tutorial that will get you up to speed with using Windsor in a simple web application. The application is called To be seen and helps user collect information about upcoming movies, CDs, books, events etc, and set up reminders for when they come up.

The tutorial assumes no prior familiarity with Windsor, any other container or related concepts. However a sound knowledge of C# and some experience with ASP.NET (hopefully in its MVC incarnation) is required.

You can find the entire code for finished application on github.

Tutorial

So far the following parts were published:

Introduction


Building the app

728x90
반응형