Replies: 1 comment
-
@Nevca I'm not sure if this is the same. In example, the public IService Root
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
Func<int, int, IDependency> transientFunc1 =
[MethodImpl(MethodImplOptions.AggressiveInlining)]
(dependencyId, subId) =>
{
int transientInt324 = subId;
int transientInt323 = dependencyId;
if (_root._singletonClock43 is null)
{
using (_lock.EnterScope())
{
if (_root._singletonClock43 is null)
{
_root._singletonClock43 = new Clock();
}
}
}
Dependency localDependency65 = new Dependency(_root._singletonClock43, transientInt323, transientInt324);
return localDependency65;
};
return new Service(transientFunc1);
}
} Pay attention to: And if the binding is changed to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm looking at this example.
As far as I understand this is the way of binding a factory, so that all dependencies of the returned instance get resolved automatically, except for the func arguments, which are being "overridden".
Is this correct, is this line:
ctx.Inject<Dependency>(out var dependency);
the equivalent of writing this using Unity:
container.Resolve<IDependency>(new ParameterOverride("dependencyId", dependencyId));
Beta Was this translation helpful? Give feedback.
All reactions