17 questions for “Dependency Injection & IoC Principles”

Found in 1 field. Select a question to see its full answer.

Information Technology

17 questions in 2 technologies

#QuestionTechnologyTopicLevel
1What is the Inversion of Control (IoC) principle, and how does dependency injection relate to it as one specific technique? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesIntermediate
2What is dependency injection, and what problem does it solve compared to a class creating its own dependencies directly? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesBeginner
3How do you register and resolve a service using ASP.NET Core's built-in dependency injection container? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesBeginner
4How would you implement the Factory pattern using dependency injection to resolve a specific implementation at runtime based on a parameter, when the standard container can't decide statically? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
5How does constructor injection differ from property (setter) injection, and why is constructor injection generally preferred? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesIntermediate
6What causes a 'captive dependency' bug, and how does ASP.NET Core's DI container detect and prevent it? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
7How do you correctly and safely resolve a Scoped service from within a Singleton service using IServiceScopeFactory, avoiding the captive dependency problem? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
8How would you write a custom IServiceProviderFactory or use a third-party container (like Autofac) to enable advanced DI features not supported by the built-in ASP.NET Core container, like property injection or convention-based registration? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced
9What is the difference between Singleton, Scoped, and Transient service lifetimes in ASP.NET Core's DI container? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesIntermediate
10How does the DI container resolve a class with MULTIPLE constructors, and how do you influence which one gets chosen? C# › Dependency Injection & IoC PrinciplesC#Dependency Injection & IoC PrinciplesAdvanced