Unity Application Block 與 ASP.NET MVC 學習資源整理

來源:互聯網
上載者:User

Inversion of control (IoC) 與 Dependency injection (DI) 是我接觸 ASP.NET MVC 之後才注意到的一門學問,對其概念十分著迷,但由於中文資訊非常少且概念也有點抽象,所以遲遲沒有上手。上個週末花了不少時間研讀相關資料,並著手寫 Code 練習套用在 ASP.NET MVC 專案中,也算小有心得,特別將一些我看過的文章、資料整理一下,方便有心學習的人。

Unity Application Block 是微軟 Enterprise Library 中多個 Application Block 中的一部份,專注於實做 Dependency injection 容器,並支援 constructor, property, and method call 注入,目前實做 DI 的函示庫很多,但由於微軟的檔案資源較為豐富,所以我就以 Unity 為入門學習的套件。

由於 DI ( IoC ) 算是個設計樣式 (Design Pattern),所以如果日後想要切換不同的 DI Framework 的話其實也不會太困難,因為觀念都是相通的,只要能理解運作的基本觀念,並且至少熟悉一套 DI Framework 就不會有太大問題,本文最後面有 各家實做的 Dependency Injection 架構比較 供各位參考。

以下是我研讀過的資料,或許對想學習 Unity / DI / IoC 的人來說會有幫助:

觀念建立

  • Inversion of control - Wikipedia, the free encyclopedia /  控制反轉
  • Dependency injection - Wikipedia, the free encyclopedia
  • Inversion of Control Containers and the Dependency Injection pattern
    • 此文作者是 Martin Fowler ( 應該是最早想出這個詞彙的人 )
  • Introduction to Unity
  • Dependency Injection [ MSDN Magazine, 2005-09 ]

 

入門教學

  • Unity Dependency Injection IoC Screencast ( 影片教學,看完後自己實做一遍應該就會了 )

    • Unity IoC and ASP.NET MVC Framework - Dependency Injection of Controllers ( 實用
    • Unity Nested Containers - IUnityContainer and CreateChildContainer
    • UnityContainer and UnityConfigurationSection - Populating Unity Container via App.config or Web.config
    • Unity Configuration from Separate Configuration File
  • Unity framework with ASP.Net MVC Framework ( 詳細的入門教學 )
  • ASP.NET MVC Tip: Dependency Injection with Unity Application Block ( 入門教學 )

 

官方網站

  • Unity Application Block ( MSDN )
  • patterns & practices – Unity ( CodePlex )

 

相關下載

  • 下載 Unity Application Block 1.2 - October 2008 ( 目前的穩定版 )

    • 預設安裝目錄為 C:\Program Files\Microsoft Unity Application Block 1.2
    • 包括: CHM 說明檔案、QuickStart 範常式式、Unity 完整原始碼、編譯好的組件
  • 下載 Unity Application Block 1.2 Documentation for Visual Studio 2008
  • 下載 Unity Application Block 1.2 Documentation for Visual Studio 2005
  • 下載 Unity Application Block 1.2 for Silverlight - December 2008

 

範常式式

  • Unity Application Block (1.2) Hands On Labs ( 好物,照著練習一遍就對了 )
  • lekker ( 管理食譜的 MVC 網站 )
    • 採用技術:ASP.NET MVC, Unity, Entity Framework, VS2008
  • P-Blog ( 部落格引擎 )
    • 採用技術:ASP.NET MVC, NHibernate, Firebird, Unity/Spring.NET IoC, NUnit
  • KiGG ( 推文網站 )
    • 採用技術:ASP.NET MVC, jQuery, Unity, Linq To SQL or Entity Framework,
      Enterprise Library (Logging & Caching), xUnit.net, … 非常多 …
  • Shrinkr ( 縮網址服務的 MVC 網站 )
    • 採用技術:ASP.NET MVC, jQuery, Unity, Entity Framework 4.0, jQuery, VS2010
    • Shrinkr - Url Shrinking Service Developed with Entity Framework 4.0, Unity, ASP.NET MVC And jQuery (Part 1)
    • Shrinkr - Url Shrinking Service Developed with Entity Framework 4.0, Unity, ASP.NET MVC And jQuery (Part 2)
    • Shrinkr - Url Shrinking Service Developed with Entity Framework 4.0, Unity, ASP.NET MVC And jQuery (Part 3)

 

相關文章

  • Inject Some Life into Your Applications—Getting to Know the Unity Application Block

    • 文章的範例專案下載:UnityGettingStartedCode.zip
    • Tame Your Software Dependencies for More Flexible Apps [ MSDN Magazine, 2008-03 ]
  • Applying Dependency Injection in ASP.NET MVC NerdDinner.com Application
  • ASP.NET MVC, UNITY AND COMMON SERVICE LOCATOR
  • How To Use Unity Container In ASP.NET
  • How To Use Unity Container In ASP.NET MVC Framework

 

部落格

  • Patterns and Practices Guidance – Unity
  • Unity - Kazi Manzur Rashid's Blog
  • Brad Wilson
  • Being Scott Densmore – Unity
  • I Think It’s Interesting - Dependency Injection
  • Martin Fowler’s Bliki

 

各家實做的 Dependency Injection 架構比較

  • Comparing .NET DI (IoC) Frameworks, Part 1
  • Comparing .NET DI (IoC) Frameworks, Part 2
  • List of .NET Dependency Injection Containers (IOC)
  • Which single IoC/DI container would you recommend using and why?
  • Which Dependency Injection Tool Should I Use?
  • IoC Container Benchmark - Unity, Windsor, StructureMap and Spring.NET

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.