Comments (8)
@detoxhby The keyed services will be supported in the DryIoc v6 version. The support is already added. The version still need the final touches.
from dryioc.
@detoxhby Here it is dotnet add package DryIoc.Microsoft.DependencyInjection --version 8.0.0-preview-01
from dryioc.
@dadhi thanks!
Will you publish pre-release for testing beforehand? Would like to help by checking out in real projects!
from dryioc.
@detoxhby Here it is
dotnet add package DryIoc.Microsoft.DependencyInjection --version 8.0.0-preview-01
thanks, we've done testing and apart from the change in ConfigureContainer calls (IContainer to DryIocServiceProvider) the only issue is the Request
class' API parameter changes of IContainer
to Container
which is a problem because generally we use the interface to reference the container and casting it down is unsafe
Can we ask why is this change was necessary? and if this is mandatory then what kind of workaround should we use to gain the typed container?
from dryioc.
Could you provide the example with the casting?
What are using Request.Container for?
from dryioc.
Could you provide the example with the casting? What are using Request.Container for?
for factory based registrations/resolutions we use this for ex.:
CurrentContainer.ResolveFactory(Request.Create(CurrentContainer, ServiceInfo.Of<T>(serviceKey: key))).FactoryID
CurrentContainer is the IContainer
and with v6 we need to cast it to (Container)
atm
from dryioc.
@detoxhby Got it, will check.
Btw, I am still interested why do it with such a "low level" DryIoc stuff, are you integrating with some lib?
from dryioc.
Btw, I am still interested why do it with such a "low level" DryIoc stuff, are you integrating with some lib?
we are mainly using it for factory-based scoped registrations to be able to replace them dynamically during an execution (actually, this solution was discussed with you a few years ago because it was not possible earlier :))
// registration
var factory = ReflectionFactory.Of(typeof(TImplementation), reuse, made, setup);
var id = new FactoryIdentifier<TService>(factory.FactoryID);
container.Register(typeof(TService), factory, ifAlreadyRegistered, serviceKey);
container.RegisterInstance(typeof(FactoryIdentifier<TService>), id, serviceKey: serviceKey);
// usage (context is IResolverContext)
context.CurrentScope.SetOrAdd(context.Resolve<FactoryIdentifier<T>>(), instance)
The previous ResolveFactory
is used in other testing env where we need to access the main factory (due to abstraction/isolation over different DI containers) but actually not mandatory functionality, we can probably drop it if required.
If there's an alternative API to avoid this we are willing to leave low-level parts behind.
from dryioc.
Related Issues (20)
- Release 5.4.2 is Broken for Framework 4.8 HOT 4
- Allow filling of properties on an existing instance
- FastExpressionCompiler fails on iOS HOT 3
- Add direct net8.0 target as soon as Appveyor CI will support it HOT 5
- ConstructorWithResolvableArguments conflicts with dynamic registrations
- For the conditional singleton or the singleton registered with AnyKey - should we create a new singleton per condition or the resolution key? HOT 1
- Why docs not mentioned with register keyed services base on attributes?
- Possibility to resolve only Non-Keyed services in the collection wrapper
- Add possibility to obtain all service keys for the registered service
- Multiple same service key support mostly for DryIoc.MS.DI though it is already supported in DryIoc.MefAttributedModel
- Move Throw.GetMatchedException to Rules so that extensions may modify it without conflicts HOT 1
- Scoped service decorator HOT 4
- Consistent behavior of a faulty singleton HOT 2
- FactoryType is not forwarded in the RegisterMapping<TService, TRegisteredService> method HOT 1
- IDisposable dependencies does not get disposed when web request ends HOT 5
- Add the HotUsedInstance for fast access to skip all the resolution steps
- Conditional registrations
- Check for mismatch lifestyle scope between service and dependencies HOT 7
- troubleshooting sudden ArgumentException at TryInterpretSingletonAndUnwrapContainerException HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dryioc.