SlideShare una empresa de Scribd logo
1 de 17
10 May, 2009 Inversion Of Control -  Spring.NETOverview
Dependencies and Dependency Injection 10 May, 2009 2 Inversion Of Control -  Spring.NET Overview
What is Dependency Injection? Dependency injection (DI) in programming refers to the process of supplying an external dependency to a software component.  It is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency. 10 May, 2009 3 Inversion Of Control -  Spring.NET Overview
But … what is Inversion of control? Inversion of control, or IoC, is an abstract principle describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to the traditional architecture. Control flow is expressed in imperative programming in the form of a series of instructions or procedure calls. Instead of specifying a sequence of decisions and procedures to occur during the lifetime of a process, the user of a IoCframework writes the desired responses linked to particular events or data requests.  10 May, 2009 4 Inversion Of Control -  Spring.NET Overview
IOC Container 10 May, 2009 5 Inversion Of Control -  Spring.NET Overview
Aha…and what is an IOC container? 10 May, 2009 6 Inversion Of Control -  Spring.NET Overview
Spring.NET an application framework for buidling Enterprise .NET applications  an IoC Container (Inversion of Control) that manages and injects dependencies on behalf of developers (DI = Dependency Injection) 10 May, 2009 Inversion Of Control -  Spring.NET Overview 7
And more… 10 May, 2009 8 Inversion Of Control -  Spring.NET Overview
IoC Containers for .NET PicoContainer.NET: lightweight and highly embeddable IoC container StructureMap:  lightweight Inversion of Control (IoC) Container written in C#; can improve the architectural qualities of .NET apps by reducing the mechanical costs of good design techniques Castle: Tools for application development including small IoC container Spring.NET: full featured IoC container (port of Java version) 10 May, 2009 9 Inversion Of Control -  Spring.NET Overview
Practice First approach - Dependencies public class ExampleObject {   private AnotherObjectobjectOne; // dependencies   private YetAnotherObjectobjectTwo;   private inti;     public AnotherObjectObjectOne { 	set { this.objectOne = value; }   }   public YetAnotherObjectObjectTwo {     	set { this.objectTwo = value; }   }   public intIntegerProperty {     	set { this.i = value; }    }   } 10 May, 2009 10 Inversion Of Control -  Spring.NET Overview
Configuration I Preferred way to create Object Factories and Application contexts is via configuration: <configuration>  <configSections>   <sectionGroup name="spring">    <section name="context"    type="Spring.Context.Support.ContextHandler, Spring.Core"/>    <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />   </sectionGroup>  </configSections>  <spring>   <context>    <resource uri="config://spring/objects"/>   </context>   <objects>    ...   </objects>  </spring> </configuration> Handlers usedfor Spring configurationsection Where to find object configuration, e.g. file, assembly, config Configurationof Spring managedobjects 10 May, 2009 11 Inversion Of Control -  Spring.NET Overview
Configuration II The configuration tells Spring.NET how objects depend on each other:  Object name Object type: namespacepath + class,  assembly <object id="exampleObject" type="Examples.ExampleObject, ExamplesLibrary">     <property name="objectOne" ref="anotherExampleObject"/>     <property name="objectTwo" ref="yetAnotherObject"/>     <property name="IntegerProperty" value="1"/> </object> <object id="anotherExampleObject" type="Examples.AnotherObject, ExamplesLibrary"/> <object id="yetAnotherObject" type="Examples.YetAnotherObject, ExamplesLibrary"/> Properties referring to other objects: often called dependencies or collaborators 10 May, 2009 12 Inversion Of Control -  Spring.NET Overview
Usage Now instantiating an   ApplicationContext is simple: ID that should appear in object configuration IApplicationContextctx = ContextRegistry.GetContext(); ExampleObject person = 	 	(ExampleObject)ctx.GetObject(“exampleObject ");  10 May, 2009 13 Inversion Of Control -  Spring.NET Overview
Example  application 10 May, 2009 14 Inversion Of Control -  Spring.NET Overview
Solve the dependencies with Spring.NET IOC Demo 10 May, 2009 15 Inversion Of Control -  Spring.NET Overview
16 Inversion Of Control -  Spring.NET Overview 10 May, 2009 http://en.wikipedia.org/wiki/Inversion_of_control http://martinfowler.com/articles/injection.html http://abdullin.com/wiki/inversion-of-control-ioc.html http://www.springframework.net/doc-latest/reference/html/objects.html http://www.developer.com/net/csharp/article.php/3722931/Dependency-Injection-with-SpringNet.htm Resources
17 Inversion Of Control -  Spring.NET Overview 10 May, 2009

Más contenido relacionado

Destacado

MIF Marketplace presentation
MIF Marketplace presentationMIF Marketplace presentation
MIF Marketplace presentation
Yves Lesenfants
 
2012-WTR Club OPP
2012-WTR Club OPP2012-WTR Club OPP
2012-WTR Club OPP
waytorich
 
Mbc Consulting Group
Mbc Consulting GroupMbc Consulting Group
Mbc Consulting Group
Kevin Cook
 
Michael Muellers Resume
Michael Muellers ResumeMichael Muellers Resume
Michael Muellers Resume
mlm_330
 
L1. intro to ethics
L1. intro to ethicsL1. intro to ethics
L1. intro to ethics
t0nywilliams
 

Destacado (20)

The rhino
The rhinoThe rhino
The rhino
 
Информационный центр StartUpSamara, С. Богданов
Информационный центр StartUpSamara, С. БогдановИнформационный центр StartUpSamara, С. Богданов
Информационный центр StartUpSamara, С. Богданов
 
MIF Marketplace presentation
MIF Marketplace presentationMIF Marketplace presentation
MIF Marketplace presentation
 
WTR Club-如何讓搜尋引擎喜歡上你的網站
WTR Club-如何讓搜尋引擎喜歡上你的網站WTR Club-如何讓搜尋引擎喜歡上你的網站
WTR Club-如何讓搜尋引擎喜歡上你的網站
 
Eng 071 aragona dc_fall11
Eng 071 aragona dc_fall11Eng 071 aragona dc_fall11
Eng 071 aragona dc_fall11
 
Gorillas by Lexi
Gorillas by LexiGorillas by Lexi
Gorillas by Lexi
 
2012-WTR Club OPP
2012-WTR Club OPP2012-WTR Club OPP
2012-WTR Club OPP
 
Инновационный центр ОАО «Ростелеком», П.Ройтберг
Инновационный центр ОАО «Ростелеком», П.РойтбергИнновационный центр ОАО «Ростелеком», П.Ройтберг
Инновационный центр ОАО «Ростелеком», П.Ройтберг
 
Mbc Consulting Group
Mbc Consulting GroupMbc Consulting Group
Mbc Consulting Group
 
Simple Ideas To Live Greener!
Simple Ideas To Live Greener!Simple Ideas To Live Greener!
Simple Ideas To Live Greener!
 
Essay Writing Business 2010
Essay Writing Business 2010Essay Writing Business 2010
Essay Writing Business 2010
 
Hippo
HippoHippo
Hippo
 
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
OneCafé: De toekomst van ledenorganisaties met behulp van CRM en informatie-u...
 
Антон Колошин - Формирование межрегионального Smart ЦОК ИТ
Антон Колошин - Формирование межрегионального Smart ЦОК ИТАнтон Колошин - Формирование межрегионального Smart ЦОК ИТ
Антон Колошин - Формирование межрегионального Smart ЦОК ИТ
 
Michael Muellers Resume
Michael Muellers ResumeMichael Muellers Resume
Michael Muellers Resume
 
How the World's Top Marketers Make Emotional Connections to Win the Marketplace
How the World's Top Marketers Make Emotional Connections to Win the MarketplaceHow the World's Top Marketers Make Emotional Connections to Win the Marketplace
How the World's Top Marketers Make Emotional Connections to Win the Marketplace
 
L1. intro to ethics
L1. intro to ethicsL1. intro to ethics
L1. intro to ethics
 
Strategy Framework
Strategy FrameworkStrategy Framework
Strategy Framework
 
UDV 2016 Final
UDV 2016 FinalUDV 2016 Final
UDV 2016 Final
 
Addicted 2 Tattoos, Tampa, FL
Addicted 2 Tattoos, Tampa, FLAddicted 2 Tattoos, Tampa, FL
Addicted 2 Tattoos, Tampa, FL
 

Similar a Inversion Of Control: Spring.Net Overview

TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
Shankar Nair
 
Spring framework
Spring frameworkSpring framework
Spring framework
srmelody
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
Adil Jafri
 

Similar a Inversion Of Control: Spring.Net Overview (20)

Spring IOC and DAO
Spring IOC and DAOSpring IOC and DAO
Spring IOC and DAO
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
Os Johnson
Os JohnsonOs Johnson
Os Johnson
 
Tdd,Ioc
Tdd,IocTdd,Ioc
Tdd,Ioc
 
Poco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class DesignPoco Es Mucho: WCF, EF, and Class Design
Poco Es Mucho: WCF, EF, and Class Design
 
Introduction To ASP.NET MVC
Introduction To ASP.NET MVCIntroduction To ASP.NET MVC
Introduction To ASP.NET MVC
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC Seminar
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 
Ibm
IbmIbm
Ibm
 
Ef Poco And Unit Testing
Ef Poco And Unit TestingEf Poco And Unit Testing
Ef Poco And Unit Testing
 
TheSpringFramework
TheSpringFrameworkTheSpringFramework
TheSpringFramework
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Object Oreinted Approach in Coldfusion
Object Oreinted Approach in ColdfusionObject Oreinted Approach in Coldfusion
Object Oreinted Approach in Coldfusion
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Ta Javaserverside Eran Toch
Ta Javaserverside Eran TochTa Javaserverside Eran Toch
Ta Javaserverside Eran Toch
 

Más de Orbit One - We create coherence

Más de Orbit One - We create coherence (20)

ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
ShareCafé: SharePoint - Een doos vol documenten of dé tool om efficiënt samen...
 
HoGent tips and tricks van een self-made ondernemer
HoGent tips and tricks van een self-made ondernemer HoGent tips and tricks van een self-made ondernemer
HoGent tips and tricks van een self-made ondernemer
 
Het Nieuwe Werken in de praktijk
Het Nieuwe Werkenin de praktijkHet Nieuwe Werkenin de praktijk
Het Nieuwe Werken in de praktijk
 
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
ShareCafé: Office365 - Efficiënt samenwerken met minimum aan kosten en comple...
 
ShareCafé 3 - Geef je samenwerking een technologische upgrade
ShareCafé 3 - Geef je samenwerking een technologische upgradeShareCafé 3 - Geef je samenwerking een technologische upgrade
ShareCafé 3 - Geef je samenwerking een technologische upgrade
 
ShareCafé 2 - Werk slimmer door geïntegreerde tools
ShareCafé 2 - Werk slimmer door geïntegreerde toolsShareCafé 2 - Werk slimmer door geïntegreerde tools
ShareCafé 2 - Werk slimmer door geïntegreerde tools
 
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
ShareCafé 1: Hou de Nieuwe Werker gemotiveerdShareCafé 1: Hou de Nieuwe Werker gemotiveerd
ShareCafé 1: Hou de Nieuwe Werker gemotiveerd
 
Business value of Lync integrations
Business value of Lync integrationsBusiness value of Lync integrations
Business value of Lync integrations
 
Identity in the cloud using Microsoft
Identity in the cloud using MicrosoftIdentity in the cloud using Microsoft
Identity in the cloud using Microsoft
 
OneCafé: The future of membership organizations facilitated by CRM and collab...
OneCafé: The future of membership organizations facilitated by CRM and collab...OneCafé: The future of membership organizations facilitated by CRM and collab...
OneCafé: The future of membership organizations facilitated by CRM and collab...
 
OneCafé: The new world of work and your organisation
OneCafé: The new world of work and your organisationOneCafé: The new world of work and your organisation
OneCafé: The new world of work and your organisation
 
Social Computing in your organization using SharePoint: challenges and benefits
Social Computing in your organization using SharePoint: challenges and benefitsSocial Computing in your organization using SharePoint: challenges and benefits
Social Computing in your organization using SharePoint: challenges and benefits
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Wie is Orbit One Internet Solutions
Wie is Orbit One Internet SolutionsWie is Orbit One Internet Solutions
Wie is Orbit One Internet Solutions
 
Azure Umbraco workshop
Azure Umbraco workshopAzure Umbraco workshop
Azure Umbraco workshop
 
Marketing Automation in Dynamics CRM with ClickDimensions
Marketing Automation in Dynamics CRM with ClickDimensionsMarketing Automation in Dynamics CRM with ClickDimensions
Marketing Automation in Dynamics CRM with ClickDimensions
 
Office 365, is cloud right for your company?
Office 365, is cloud right for your company?Office 365, is cloud right for your company?
Office 365, is cloud right for your company?
 
Who is Orbit One internet solutions?
Who is Orbit One internet solutions?Who is Orbit One internet solutions?
Who is Orbit One internet solutions?
 
Azure and Umbraco CMS
Azure and Umbraco CMSAzure and Umbraco CMS
Azure and Umbraco CMS
 
Ingredients of the new world of work
Ingredients of the new world of workIngredients of the new world of work
Ingredients of the new world of work
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Inversion Of Control: Spring.Net Overview

  • 1. 10 May, 2009 Inversion Of Control - Spring.NETOverview
  • 2. Dependencies and Dependency Injection 10 May, 2009 2 Inversion Of Control - Spring.NET Overview
  • 3. What is Dependency Injection? Dependency injection (DI) in programming refers to the process of supplying an external dependency to a software component. It is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed dependency. 10 May, 2009 3 Inversion Of Control - Spring.NET Overview
  • 4. But … what is Inversion of control? Inversion of control, or IoC, is an abstract principle describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to the traditional architecture. Control flow is expressed in imperative programming in the form of a series of instructions or procedure calls. Instead of specifying a sequence of decisions and procedures to occur during the lifetime of a process, the user of a IoCframework writes the desired responses linked to particular events or data requests. 10 May, 2009 4 Inversion Of Control - Spring.NET Overview
  • 5. IOC Container 10 May, 2009 5 Inversion Of Control - Spring.NET Overview
  • 6. Aha…and what is an IOC container? 10 May, 2009 6 Inversion Of Control - Spring.NET Overview
  • 7. Spring.NET an application framework for buidling Enterprise .NET applications an IoC Container (Inversion of Control) that manages and injects dependencies on behalf of developers (DI = Dependency Injection) 10 May, 2009 Inversion Of Control - Spring.NET Overview 7
  • 8. And more… 10 May, 2009 8 Inversion Of Control - Spring.NET Overview
  • 9. IoC Containers for .NET PicoContainer.NET: lightweight and highly embeddable IoC container StructureMap: lightweight Inversion of Control (IoC) Container written in C#; can improve the architectural qualities of .NET apps by reducing the mechanical costs of good design techniques Castle: Tools for application development including small IoC container Spring.NET: full featured IoC container (port of Java version) 10 May, 2009 9 Inversion Of Control - Spring.NET Overview
  • 10. Practice First approach - Dependencies public class ExampleObject { private AnotherObjectobjectOne; // dependencies private YetAnotherObjectobjectTwo; private inti; public AnotherObjectObjectOne { set { this.objectOne = value; } } public YetAnotherObjectObjectTwo { set { this.objectTwo = value; } } public intIntegerProperty { set { this.i = value; } } } 10 May, 2009 10 Inversion Of Control - Spring.NET Overview
  • 11. Configuration I Preferred way to create Object Factories and Application contexts is via configuration: <configuration> <configSections> <sectionGroup name="spring"> <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/> <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" /> </sectionGroup> </configSections> <spring> <context> <resource uri="config://spring/objects"/> </context> <objects> ... </objects> </spring> </configuration> Handlers usedfor Spring configurationsection Where to find object configuration, e.g. file, assembly, config Configurationof Spring managedobjects 10 May, 2009 11 Inversion Of Control - Spring.NET Overview
  • 12. Configuration II The configuration tells Spring.NET how objects depend on each other: Object name Object type: namespacepath + class, assembly <object id="exampleObject" type="Examples.ExampleObject, ExamplesLibrary"> <property name="objectOne" ref="anotherExampleObject"/> <property name="objectTwo" ref="yetAnotherObject"/> <property name="IntegerProperty" value="1"/> </object> <object id="anotherExampleObject" type="Examples.AnotherObject, ExamplesLibrary"/> <object id="yetAnotherObject" type="Examples.YetAnotherObject, ExamplesLibrary"/> Properties referring to other objects: often called dependencies or collaborators 10 May, 2009 12 Inversion Of Control - Spring.NET Overview
  • 13. Usage Now instantiating an ApplicationContext is simple: ID that should appear in object configuration IApplicationContextctx = ContextRegistry.GetContext(); ExampleObject person = (ExampleObject)ctx.GetObject(“exampleObject "); 10 May, 2009 13 Inversion Of Control - Spring.NET Overview
  • 14. Example application 10 May, 2009 14 Inversion Of Control - Spring.NET Overview
  • 15. Solve the dependencies with Spring.NET IOC Demo 10 May, 2009 15 Inversion Of Control - Spring.NET Overview
  • 16. 16 Inversion Of Control - Spring.NET Overview 10 May, 2009 http://en.wikipedia.org/wiki/Inversion_of_control http://martinfowler.com/articles/injection.html http://abdullin.com/wiki/inversion-of-control-ioc.html http://www.springframework.net/doc-latest/reference/html/objects.html http://www.developer.com/net/csharp/article.php/3722931/Dependency-Injection-with-SpringNet.htm Resources
  • 17. 17 Inversion Of Control - Spring.NET Overview 10 May, 2009