https://github.com/rkosafo/alternatedependencyinjection
An attempt to separate interfaces and implementations for asp.net application
https://github.com/rkosafo/alternatedependencyinjection
Last synced: 3 months ago
JSON representation
An attempt to separate interfaces and implementations for asp.net application
- Host: GitHub
- URL: https://github.com/rkosafo/alternatedependencyinjection
- Owner: rkosafo
- Created: 2021-01-16T05:42:25.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-16T06:38:11.000Z (over 4 years ago)
- Last Synced: 2025-01-08T17:40:06.873Z (5 months ago)
- Language: C#
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AlternateDependencyInjection
An attempt to separate interfaces and implementations for asp.net application## Motivation
Modern DI includes wonderful things like
- Constructor Injection
- Property Injection
- etc## Attempt 1
- Create Interface for the service
- Create a static class that implements the needed functions on the interface
- To use the service, just use the functions defined on the static service class
- On init, set the implementation that static service should use## Attempt 2
- Starts off like attempt 1 but instead of exposing the functions on the static class, the interface is rather exposed.
This has the benefit of reducing the amount of coding needed to expose the service
- Using the singleton pattern, introduce a **shared** or **singleton** property that exposes the implementation
- Add a fatory function that can create instances if needed# Questions
- Will lazy help here?