Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Agenda
SOLID Principles
Dependency Inversion, IoC, Dependency Injection
Pros and cons of Dependency Injection
Apply DI fra...
SOLID Principles
• Single Responsibility
• Open/Closed
• Liskov Substitution
• Interface Segregation
• Dependency Inversion
Database
Data Access Layer
Which Depends On
Business Logic Layer
Which Depends On
User Interface
Depends on
Dependencies
L...
Example Code
Dependencies Inversion (Principle)
Inversion of Control (Pattern)
Service Locator Event Delegate
Dependency
Injection
Example Code
Why Dependency Injection
• Loose coupling code
• Testability
• Clear dependency
• Separate of concern
• Easy to change
Why NOT Dependency
Injection
• Hard to learn
• Hard to debug
• Object created before needed
• More layer => More complexity
Simple DI Container
IoC in Action
Unity
Ninject
Structure Map
What
An “object to object”
mapper
Why
Remove the boring
mapping code
When
Entity to DTO
Entity to Data Contact
Entity to V...
Before and after
Mapper in Action
IoC and Mapper in C#
IoC and Mapper in C#
Upcoming SlideShare
Loading in …5
×

of

IoC and Mapper in C# Slide 1 IoC and Mapper in C# Slide 2 IoC and Mapper in C# Slide 3 IoC and Mapper in C# Slide 4 IoC and Mapper in C# Slide 5 IoC and Mapper in C# Slide 6 IoC and Mapper in C# Slide 7 IoC and Mapper in C# Slide 8 IoC and Mapper in C# Slide 9 IoC and Mapper in C# Slide 10 IoC and Mapper in C# Slide 11 IoC and Mapper in C# Slide 12 IoC and Mapper in C# Slide 13 IoC and Mapper in C# Slide 14 IoC and Mapper in C# Slide 15
Upcoming SlideShare
The evolution of java script asynchronous calls
Next
Download to read offline and view in fullscreen.

4 Likes

Share

Download to read offline

IoC and Mapper in C#

Download to read offline

A simple slide about DI, IoC, Mapper in C#.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

IoC and Mapper in C#

  1. 1. Agenda SOLID Principles Dependency Inversion, IoC, Dependency Injection Pros and cons of Dependency Injection Apply DI frameworks into MVC project AutoMapper – What, Why and How
  2. 2. SOLID Principles • Single Responsibility • Open/Closed • Liskov Substitution • Interface Segregation • Dependency Inversion
  3. 3. Database Data Access Layer Which Depends On Business Logic Layer Which Depends On User Interface Depends on Dependencies Lower application layers External services Other components
  4. 4. Example Code
  5. 5. Dependencies Inversion (Principle) Inversion of Control (Pattern) Service Locator Event Delegate Dependency Injection
  6. 6. Example Code
  7. 7. Why Dependency Injection • Loose coupling code • Testability • Clear dependency • Separate of concern • Easy to change
  8. 8. Why NOT Dependency Injection • Hard to learn • Hard to debug • Object created before needed • More layer => More complexity
  9. 9. Simple DI Container
  10. 10. IoC in Action Unity Ninject Structure Map
  11. 11. What An “object to object” mapper Why Remove the boring mapping code When Entity to DTO Entity to Data Contact Entity to View Model
  12. 12. Before and after
  13. 13. Mapper in Action
  • SngH4

    Feb. 6, 2018
  • huuhoang3

    Sep. 18, 2017
  • DmitriyMatvienko

    Mar. 8, 2016
  • JasonNguyen12

    Nov. 10, 2015

A simple slide about DI, IoC, Mapper in C#.

Views

Total views

147,044

On Slideshare

0

From embeds

0

Number of embeds

141,846

Actions

Downloads

119

Shares

0

Comments

0

Likes

4

×