https://github.com/peteraritchie/dicore
An essential library for facilitating Dependency Inversion in .NET
https://github.com/peteraritchie/dicore
Last synced: 9 months ago
JSON representation
An essential library for facilitating Dependency Inversion in .NET
- Host: GitHub
- URL: https://github.com/peteraritchie/dicore
- Owner: peteraritchie
- License: mit
- Created: 2016-05-13T18:15:46.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-25T16:26:32.000Z (almost 8 years ago)
- Last Synced: 2025-03-01T15:18:30.055Z (over 1 year ago)
- Language: C#
- Size: 55.7 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DICore
[](https://ci.appveyor.com/project/peteraritchie/dicore)
A library for facilitating [Dependency Inversion](https://en.wikipedia.org/wiki/Dependency_inversion_principle)
With many frameworks, interface-driven design is non-existant or spotty. The ability for your code to *depend on abstractions* can be difficult. While abstractions around framework types can be hand-crafted, and an application-specific abstraction that makes the implicit more explicit can be created, it's time-consuming and of specious value given the use of frameworks that themselves provide abstractions.
This library doesn't try to replace good design. If an application-specific type can better wrap a framework type or set of framework types, the design should prefer that design methodology of wholesale use of this library.
None-the-less, this library begins the process of creating abstractions from .NET Framework types that don't fully implement abstractions (in this case interfaces)
The core contains a small set of utility classes to aid in reducing dependency on concrete classes (or the creation of concrete classes). The code includes types such as `FuncComparable`, `FuncComparer`, `FuncEqualityComparer`, and `FuncEquatable` to provide delegate-based interface implementations for some common .NET Framework interfaces such as `IComparable`, `IComparer`, `IEqualityComparer`, and `IEquatable`. In addition, the library includes the best practice of an abstract factory `IFactory` and a similar delegate-based implementation `FuncFactory` to aid in avoiding such anti-patterns as [Service Locator](http://blog.ploeh.dk/2010/02/03/ServiceLocatorisanAnti-Pattern/)