Mid From PDF SOLID Design Patterns & SOLID

Can DI be used without a DI container? How?

Yes, DI can be implemented manually without using a DI container. You simply pass

dependencies through constructors or methods:

public class OrderService
{
private readonly IOrderRepository _repo;
public OrderService(IOrderRepository repo)
{
_repo = repo;
}
}

// Manual injection

var repo = new OrderRepository();
var service = new OrderService(repo);

This is suitable for small or simple applications, though not scalable for large apps.

More from Design Patterns in C#

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details