Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nttlimitedrd/autofac.extras.versioning
Example of a versioned service locator using Autofac
https://github.com/nttlimitedrd/autofac.extras.versioning
Last synced: 20 days ago
JSON representation
Example of a versioned service locator using Autofac
- Host: GitHub
- URL: https://github.com/nttlimitedrd/autofac.extras.versioning
- Owner: NTTLimitedRD
- Created: 2014-11-26T05:13:31.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-26T05:36:52.000Z (about 10 years ago)
- Last Synced: 2023-02-26T16:35:44.508Z (almost 2 years ago)
- Language: C#
- Size: 191 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Autofac.Extras.Versioning
=========================Example of a versioned service locator using Autofac.
You can add an attribute to your constructors to specify the version of a dependency to be resolved from the container.
When you register components.
What, Why?
==============Lets say you want to run 2 implementations of a common service, e.g.
IMyRestApiClient
Let's say the implementations of IMyRestApiClient change, the vendor changes the API on you (not again!).
But, you have some existing code running on the old API and you want to take advantage of the new service methods.
You can register a MyRestApiClientv1 and MyRestApiClientv2 and specify the version for each component on registration.
Then, when resolving using the constructor resolver you can specify the version for each required Interface. e.g.
```
public ExampleClass
(
[VersionedDependency(VersionRange.Version2)]
IDependentInterface myInterface
)
{
myImplementation = myInterface;
}
```
This will make sure you get a component that was registered as being the implementation for Version1.TODO
===========Add an extension method for registering Versioned instead of using Keyed