


IoC Container: A tool that automates DI. Instead of the program controlling the flow, an external "Container" resolves and injects dependencies. Examples: Autofac, Unity, Ninject.
Service Lifetimes:
New instance created every time. Best for short-lived, lightweight operations.
One instance per HTTP request. Shared across components within that same request (e.g., DbContext).
One instance shared throughout the entire application lifetime. Ideal for caching and configurations.
More flexible than built-in DI. Supports RegisterType<T>() for creating new instances and RegisterInstance(obj) for existing objects (Singleton behavior).



S - Single Responsibility: One reason to change. Separate User info from DB logic.
O - Open/Closed: Open for extension, closed for modification.
L - Liskov Substitution: Subtypes must be substitutable for their base types (The Bird/Penguin problem).
I - Interface Segregation: Don't force implementation of unused methods. Split large interfaces.
D - Dependency Inversion: Depend on abstractions, not concretions.





