Comments (4)
You are doing this:
public class BaseClass
{
public BaseClass(SubClass sub)
{
}
}
public class SubClass : BaseClass
{
}
It will not work in unity. You can only depend on registrations at the same level or below it.
Imagine scenario where container2 is disposed alone with your Base
instance. This will dispose the instance that Dependent
holds but Dependent
will have no idea and will try to use it.
from container.
Thanks for clarification.
You can only depend on registrations at the same level or below it.
Imagine scenario where container2 is disposed alone with your Base instance. This will dispose the instance that Dependent holds but Dependent will have no idea and will try to use it.
This looks reasonable enough, and it does explain why registering the dependent class as transient works, but I could not find it stated explicitly in the docs. Can you add it? Or I'm willing to make a PR to https://github.com/unitycontainer/documentation/blob/master/tutorials/hierarchies.md if that's preferable.
from container.
Absolutely, would appreciate any help with that.
from container.
@ENikS The PR is ready for review, can you take a look? unitycontainer/documentation#23
from container.
Related Issues (20)
- Upgrading from 4.0.1 to 5.11.8. Question about TearDown and IBuilderPolicy HOT 3
- UnityContainerExtensions.Resolve(this IUnityContainer container, Type t, string name, params ResolverOverride[] overrides) seems to be missing HOT 1
- BuildUp with InjectionMethod run-time configuration and Diagnostic() throws "Injected method could not be matched with any public methods"
- Empty Version Zip And Tar.gz files (unity-5.8.13.576) HOT 1
- Unity.nuspec does not explicitly list DLL dependencies, which cause runtime issues
- Unable to resolve from ChildContainer when using singleton HOT 1
- Is it really necessary for a UnityContaner to hold the list of the ChildContainers created by it? HOT 16
- Is there a possibility to remove Extensions that have been added with container.AddExtension(....)? HOT 1
- Enabling diagnostic breaks functionality HOT 1
- RegisterInstance() throws incorrect exception
- ResolvedParameter() and OptionalParameter() ignore name of the dependency
- Is CommonServiceLocation replaced with CommonServiceLocator HOT 1
- Intermittent Failure During Resolve Process HOT 1
- VerificationException in TransientLifetimeManager on Azure DevOps HOT 1
- Override MethodProcessor HOT 6
- RegisterType throws InvalidOperationException when no constructor could be matched with injected member
- Invalid ("dead") license URL for NuGet package 'Unity'
- Stackoverflow even with `Diagnostic` extension enabled HOT 8
- ResolverOverride Legacy Extension not working in Unity > 5.11.6 when using .NET Framework 4.8, or .NET6
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 container.