introduction to dependency injection using spring.net

16
Introduction to Dependency Injection using Spring.NET Ryan Montgomery

Upload: ryan-montgomery

Post on 16-Apr-2017

4.081 views

Category:

Business


3 download

TRANSCRIPT

Page 1: Introduction To Dependency Injection Using Spring.NET

Introduction to Dependency Injection using Spring.NETRyan Montgomery

Page 2: Introduction To Dependency Injection Using Spring.NET

So why Spring.NET?1. We use more than IoC.2. Well documented.3. Large community.4. A proven framework.5. Supported.

Page 3: Introduction To Dependency Injection Using Spring.NET

Spring.Core1. IoC is the heart of spring.2. Additional Features

1. Expression Language2. Validation Framework3. Data binding Framework4. Dynamic Reflection5. Threading6. Resource abstraction

Page 4: Introduction To Dependency Injection Using Spring.NET

What is Inversion of Control?•Hollywood Principle.

▫“Don't call us, we'll call you.”•Dependency Injection•Service Locator

Page 5: Introduction To Dependency Injection Using Spring.NET

What is Dependency Injection?•“Dependency injection is a style of object

configuration in which an objects fields and collaborators are set by an external entity. In other words objects are configured by an external entity. Dependency injection is an alternative to having the object configure itself.”▫Jenkov Aps

Page 6: Introduction To Dependency Injection Using Spring.NET

DAO Refactor 0

Page 7: Introduction To Dependency Injection Using Spring.NET

DAO Refactor 0

Page 8: Introduction To Dependency Injection Using Spring.NET

DAO Refactor 1

Page 9: Introduction To Dependency Injection Using Spring.NET

DAO Refactor 2

Page 10: Introduction To Dependency Injection Using Spring.NET

Biz Component

Page 11: Introduction To Dependency Injection Using Spring.NET

Biz Component

Page 12: Introduction To Dependency Injection Using Spring.NET

Spring IoC Container1. Responsible for the

Instantiation and Injection of dependencies based on configuration.

2. The IObjectFactory is the actual representation of the Spring IoC container.

3. The most commonly used IObjectFactory implementation is the XmlObjectFactory class.

Page 13: Introduction To Dependency Injection Using Spring.NET

Demo

This demonstration is based on the Movie Finder example in Spring.NET.

Page 14: Introduction To Dependency Injection Using Spring.NET

Contact Information•Ryan Montgomery

▫Blog http://rmontgomery429.blogspot.com

▫Email [email protected]

•Rapidparts Inc.▫Site

http://www.rpionline.com▫Blog

http://blogs.rpionline.com

Page 15: Introduction To Dependency Injection Using Spring.NET

References• Spring.NET Framework

▫Chapter 5. The IoC container http://www.springframework.net/doc-latest/

reference/html/objects.html• Martin Fowler

▫Inversion of Control Containers and the Dependency Injection pattern http://martinfowler.com/articles/injection.html

• Jenkov▫What is Dependency Injection

http://tutorials.jenkov.com/dependency-injection/index.html

Page 16: Introduction To Dependency Injection Using Spring.NET

Parking Lot