SlideShare a Scribd company logo
1 of 75
Dependency Injection
in Episerver
Dependency Injection
in .Net
wałdis iljuczonok (aka technical fellow)
tech guy at getadigital.com
(Microsoft .Net + Episerver) ◦ MVP
@tech_fellow
Why?
Testability
@tech_fellow
What is dependency?
public class Class1
{
public Class1()
{
}
public Answer Method1(string directory)
{
// ....
return ...;
}
}
@tech_fellow
«DI is a set of principles and patterns that enable loose
coupling* »
* - http://blog.ploeh.dk/2010/04/07/DependencyInjectionisLooseCoupling/
@tech_fellow
s.o.l.i.d.
@tech_fellow
s.o.l.i.d.
Patterns
public class Class1
{
private readonly ISomeService _service;
public Class1(ISomeService service)
{
_service = service;
}
public IAnotherService AnotherService { private get; set; }
public Answer Method1(IThirdService thridService)
{
return thridService.CouldBe() ? Answer.Yes() : Answer.No();
}
}
Constructor Injection
Property Injection
Method Injection
public static class AmbientContext
{
public static ISomeService TheService { get; } = new SomeService();
}
Ambient Context
@tech_fellow
Composition Root
Layered
Onion
hexagonal
pizza
@tech_fellow
Main(string[] args)
Global.asax & IControllerFactory
Startup.cs & RouterMiddleware
..rely on framework..
@tech_fellow
IConfigurableModule
IInitializableModule*
Anti-Patterns
@tech_fellow
Control Freak
public class Class1
{
private readonly ISomeService _service;
public Class1(ISomeService service)
{
_service = service;
}
public IAnotherService AnotherService { private get; set; }
public Answer Method1(IThirdService thridService)
{
return thridService.CouldBe() ? Answer.Yes() : Answer.No();
}
}
public class Class1
{
private readonly ISomeService _service;
public Class1()
{
_service = new SomeService();
}
public IAnotherService AnotherService { private get; set; }
public Answer Method1()
{
var thridService = new ThirdService();
return thridService.CouldBe() ? Answer.Yes() : Answer.No();
}
}
@tech_fellow
Control Freak
Bastard Injections
public class Class1
{
private readonly ISomeService _service;
public Class1()
{
_service = new SomeService();
}
public IAnotherService AnotherService { private get; set; }
public Answer Method1()
{
var thridService = new ThirdService();
return thridService.CouldBe() ? Answer.Yes() : Answer.No();
}
}
public class Class1
{
private readonly ISomeService _service;
public Class1(ISomeService service)
{
_service = service;
}
public Class1()
{
_service = new SomeService();
}
public IAnotherService AnotherService { private get; set; }
public Answer Method1()
{
var thridService = new ThirdService();
return thridService.CouldBe() ? Answer.Yes() : Answer.No();
}
}
@tech_fellow
Control Freak
Bastard Injections
Constrained Construction
@tech_fellow
Control Freak
Bastard Injections
Constrained Construction
Service Locator
[Fact]
public void TestMethod1()
{
var kpi = new Kpi();
kpi.Evaluate(this, new EventArgs());
...
}
@tech_fellow
@tech_fellow
T Injected<T>
T ServiceAccessor<out T>
Don’t ask, we will call you!
Hollywood Principle
DI in Episerver
@tech_fellow
Scheduled Jobs
@tech_fellow
Configurable Modules
&
Initializable Modules
@tech_fellow
Episerver Forms Actors
@tech_fellow
Razor Page*
@tech_fellow
Extension Methods
@tech_fellow
Episerver Developer Tools AddOn
DI Friendly Libraries
@tech_fellow
Libraries are designed to be «consumed»
@tech_fellow
Conforming Container
(anti-pattern)
@tech_fellow
FeatureSwitch
*.Ninject
*.StructureMap
*.Unity
*.<your-container>
*.Ninject
*.StructureMap
*.Unity
*.<your-container>
@tech_fellow
AbstractFactory
public delegate object SingleInstanceFactory(Type target);
public class TypeAbstractFactory
{
private readonly SingleInstanceFactory _factory;
public TypeAbstractFactory(SingleInstanceFactory factory)
{
_factory = factory;
}
private void CreateTargetType()
{
var s = (ISomeService)_factory(typeof(ISomeService));
}
}
context.Container.Configure(
c => c.For<SingleInstanceFactory>()
.Use<SingleInstanceFactory>(ctx => ctx.GetInstance));
public delegate object SingleInstanceFactory(Type target);
public class TypeAbstractFactory
{
private readonly SingleInstanceFactory _factory;
public TypeAbstractFactory(SingleInstanceFactory factory)
{
_factory = factory;
}
private void CreateTargetType()
{
var s = (ISomeService)_factory(typeof(ISomeService));
}
}
@tech_fellow
Constructor Over-Injection
DI Friendly Framework
@tech_fellow
[ServiceConfiguration( … )]
@tech_fellow
RRR
Register-(Resolve-Release)
public delegate object SingleInstanceFactory(Type target);
public class TypeAbstractFactory
{
private readonly SingleInstanceFactory _factory;
public TypeAbstractFactory(SingleInstanceFactory factory)
{
_factory = factory;
}
private void CreateTargetType()
{
var s = (ISomeService)_factory(typeof(ISomeService));
}
}
@tech_fellow
Remember to Release
Extra Bonus with DI
@tech_fellow
Aspects
(Interceptors & Decorators)
russian doll model
https://cynthianewberrymartin.files.wordpress.com/2009/05/blog-2-13.jpg
@tech_fellow
Validation
Pre/post processing
Authorization
Logging
Auditing
Event dispatching
Notifications
Unit of work/transactions
...
@tech_fellow
Create loose-coupling code
Demand dependencies from consumer
Leverage DI container features
Look for anti-patterns
@tech_fellow
Be a BOY SCOUT!
Dependency Injection in Episerver and .Net

More Related Content

What's hot

Testers guide to unit testing
Testers guide to unit testingTesters guide to unit testing
Testers guide to unit testingCraig Risi
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMURaffi Khatchadourian
 
Static program analysis tools
Static program analysis toolsStatic program analysis tools
Static program analysis toolsKamil Jezek
 
The Erlang Programming Language
The Erlang Programming LanguageThe Erlang Programming Language
The Erlang Programming LanguageDennis Byrne
 
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...Raffi Khatchadourian
 
Rock Your Code with Code Contracts
Rock Your Code with Code ContractsRock Your Code with Code Contracts
Rock Your Code with Code ContractsDavid McCarter
 
Poster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsPoster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsRaffi Khatchadourian
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
 
Pj01 4-operators and control flow
Pj01 4-operators and control flowPj01 4-operators and control flow
Pj01 4-operators and control flowSasidharaRaoMarrapu
 
Simulado java se 7 programmer
Simulado java se 7 programmerSimulado java se 7 programmer
Simulado java se 7 programmerMiguel Vilaca
 
Microservices Pain: Testing
Microservices Pain: TestingMicroservices Pain: Testing
Microservices Pain: TestingDavid Dawson
 
Test driven development
Test driven developmentTest driven development
Test driven developmentJohn Walsh
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012Yaqi Zhao
 
Integration of Cincom Smalltalk Systems
Integration of Cincom Smalltalk SystemsIntegration of Cincom Smalltalk Systems
Integration of Cincom Smalltalk SystemsESUG
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google MockICS
 
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...STAMP Project
 

What's hot (20)

Testers guide to unit testing
Testers guide to unit testingTesters guide to unit testing
Testers guide to unit testing
 
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMUAutomated Refactoring of Legacy Java Software to Default Methods Talk at GMU
Automated Refactoring of Legacy Java Software to Default Methods Talk at GMU
 
Static program analysis tools
Static program analysis toolsStatic program analysis tools
Static program analysis tools
 
The Erlang Programming Language
The Erlang Programming LanguageThe Erlang Programming Language
The Erlang Programming Language
 
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
 
Rock Your Code with Code Contracts
Rock Your Code with Code ContractsRock Your Code with Code Contracts
Rock Your Code with Code Contracts
 
Poster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default MethodsPoster on Automated Refactoring of Legacy Java Software to Default Methods
Poster on Automated Refactoring of Legacy Java Software to Default Methods
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
TDD Training
TDD TrainingTDD Training
TDD Training
 
Exploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systemsExploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systems
 
Pj01 4-operators and control flow
Pj01 4-operators and control flowPj01 4-operators and control flow
Pj01 4-operators and control flow
 
Simulado java se 7 programmer
Simulado java se 7 programmerSimulado java se 7 programmer
Simulado java se 7 programmer
 
Microservices Pain: Testing
Microservices Pain: TestingMicroservices Pain: Testing
Microservices Pain: Testing
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
PHPUnit - Unit testing
PHPUnit - Unit testingPHPUnit - Unit testing
PHPUnit - Unit testing
 
Pyconie 2012
Pyconie 2012Pyconie 2012
Pyconie 2012
 
Clean Code 2
Clean Code 2Clean Code 2
Clean Code 2
 
Integration of Cincom Smalltalk Systems
Integration of Cincom Smalltalk SystemsIntegration of Cincom Smalltalk Systems
Integration of Cincom Smalltalk Systems
 
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
[Webinar] Qt Test-Driven Development Using Google Test and Google Mock
 
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
Mutate and Test your Tests with STAMP, Caroline Landry, Inria, Paris Open Sou...
 

Similar to Dependency Injection in Episerver and .Net

Internet programming slide - java.ppt
Internet programming slide - java.pptInternet programming slide - java.ppt
Internet programming slide - java.pptMikeAdva
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
 
SOLID & IoC Principles
SOLID & IoC PrinciplesSOLID & IoC Principles
SOLID & IoC PrinciplesPavlo Hodysh
 
.Net december 2017 updates - Tamir Dresher
.Net december 2017 updates - Tamir Dresher.Net december 2017 updates - Tamir Dresher
.Net december 2017 updates - Tamir DresherTamir Dresher
 
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdf
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdfGLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdf
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdfNicholasflqStewartl
 
"Quantum" performance effects
"Quantum" performance effects"Quantum" performance effects
"Quantum" performance effectsSergey Kuksenko
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
 
7 stages of unit testing
7 stages of unit testing7 stages of unit testing
7 stages of unit testingJorge Ortiz
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupDror Helper
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingSteven Smith
 
SoCal Code Camp 2015: An introduction to Java 8
SoCal Code Camp 2015: An introduction to Java 8SoCal Code Camp 2015: An introduction to Java 8
SoCal Code Camp 2015: An introduction to Java 8Chaitanya Ganoo
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testingEric (Trung Dung) Nguyen
 
JDD 2016 - Sebastian Malaca - You Dont Need Unit Tests
JDD 2016 - Sebastian Malaca - You Dont Need Unit TestsJDD 2016 - Sebastian Malaca - You Dont Need Unit Tests
JDD 2016 - Sebastian Malaca - You Dont Need Unit TestsPROIDEA
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 

Similar to Dependency Injection in Episerver and .Net (20)

Test Engine
Test EngineTest Engine
Test Engine
 
Internet programming slide - java.ppt
Internet programming slide - java.pptInternet programming slide - java.ppt
Internet programming slide - java.ppt
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
L04 Software Design 2
L04 Software Design 2L04 Software Design 2
L04 Software Design 2
 
SOLID & IoC Principles
SOLID & IoC PrinciplesSOLID & IoC Principles
SOLID & IoC Principles
 
.Net december 2017 updates - Tamir Dresher
.Net december 2017 updates - Tamir Dresher.Net december 2017 updates - Tamir Dresher
.Net december 2017 updates - Tamir Dresher
 
Test Engine
Test EngineTest Engine
Test Engine
 
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdf
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdfGLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdf
GLA-01- Java- Big O and Lists Overview and Submission Requirements You.pdf
 
"Quantum" performance effects
"Quantum" performance effects"Quantum" performance effects
"Quantum" performance effects
 
Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)
 
7 stages of unit testing
7 stages of unit testing7 stages of unit testing
7 stages of unit testing
 
Devoxx 2012 (v2)
Devoxx 2012 (v2)Devoxx 2012 (v2)
Devoxx 2012 (v2)
 
L04 Software Design Examples
L04 Software Design ExamplesL04 Software Design Examples
L04 Software Design Examples
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit Testing
 
SoCal Code Camp 2015: An introduction to Java 8
SoCal Code Camp 2015: An introduction to Java 8SoCal Code Camp 2015: An introduction to Java 8
SoCal Code Camp 2015: An introduction to Java 8
 
The real beginner's guide to android testing
The real beginner's guide to android testingThe real beginner's guide to android testing
The real beginner's guide to android testing
 
JDD 2016 - Sebastian Malaca - You Dont Need Unit Tests
JDD 2016 - Sebastian Malaca - You Dont Need Unit TestsJDD 2016 - Sebastian Malaca - You Dont Need Unit Tests
JDD 2016 - Sebastian Malaca - You Dont Need Unit Tests
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 

More from Valdis Iljuconoks

More from Valdis Iljuconoks (11)

Loving data with F#
Loving data with F#Loving data with F#
Loving data with F#
 
Lap around Visual Studio 2013
Lap around Visual Studio 2013Lap around Visual Studio 2013
Lap around Visual Studio 2013
 
Client side development with knockout.js
Client side development with knockout.jsClient side development with knockout.js
Client side development with knockout.js
 
Asp.Net MVC overview
Asp.Net MVC overviewAsp.Net MVC overview
Asp.Net MVC overview
 
CSharp 5 Async
CSharp 5 AsyncCSharp 5 Async
CSharp 5 Async
 
Lean Development with TFServices
Lean Development with TFServicesLean Development with TFServices
Lean Development with TFServices
 
Introduction to FSharp
Introduction to FSharpIntroduction to FSharp
Introduction to FSharp
 
Parallel development in VS 2012
Parallel development in VS 2012Parallel development in VS 2012
Parallel development in VS 2012
 
Windows phone development
Windows phone developmentWindows phone development
Windows phone development
 
Knockoutjs UG meeting presentation
Knockoutjs UG meeting presentationKnockoutjs UG meeting presentation
Knockoutjs UG meeting presentation
 
Parallel Development in VS10
Parallel Development in VS10Parallel Development in VS10
Parallel Development in VS10
 

Recently uploaded

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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 WorkerThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.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
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Dependency Injection in Episerver and .Net

Editor's Notes

  1. DI fuels SOLID
  2. DI fuels SOLID Dependency Inversion Principle (the D in SOLID) is the guiding principle behind DI.
  3. Compose whole graph and get DI container out of way in layers below. Read bottom-up = to understand dependency graph and required dependencies for other services.
  4. Cannot replace dependencies after application has been compiled (in unit tests). Drags unnecessary dependencies.
  5. Main problem – it uses FOREIGN DEFAULT
  6. We lose flexibility. Fx does not know what exactly component will need for composition.
  7. The essence here – is not how component is constructed, but how it’s used.
  8. EPiServer.Forms.Core.PostSubmissionActor.ActorsExecutingService
  9. Refactor to Facasde Services, makes it easy to see and react on violation of SRP.
  10. Frameworks are designed with Dependency Inversion in mind. You implement interface, register it (in composition root) and framework calls you. Framework is the consumer of the client code. It CREATES instances of the client code!
  11. It hides registration details that would be explicitly visible in composition root (no room for 2 in container) How to unregister (clear out) previous registrations for an object? It’s hard to know lifetime of the dependency (wrong assumptions could be made)
  12. Respects Open/Closed Principle, Liskov comes into play