You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Say I have a notification service registered: builder.Bind<INotification>().To<PopUpNotification>().InSingletonScope();. If I have a class directly contains it as property, styelet IoC inject it without a problem. For example:
builder.Bind<INotification>().To<PopUpNotification>().InSingletonScope();
builder.Bind<A>().ToSelf();
Class A
{
public INotification notifier { get; set; }
}
However, if class A itself is a property of class B, stylet IoC does not inject INotification for AProperty if I only register B.
builder.Bind<INotification>().To<PopUpNotification>().InSingletonScope();
builder.Bind<B>().ToSelf();
Class B
{
public A AProperty { get; set; }
}
Class A
{
public INotification notifier { get; set; }
}
Is this behavior expected? Do I need explicitly bind A as well in order for Stylet IoC to inject INotification like this?
builder.Bind<INotification>().To<PopUpNotification>().InSingletonScope();
builder.Bind<A>().ToSelf();
builder.Bind<B>().ToSelf();
Class B
{
public A AProperty { get; set; }
}
Class A
{
public INotification notifier { get; set; }
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Say I have a notification service registered:
builder.Bind<INotification>().To<PopUpNotification>().InSingletonScope();
. If I have a class directly contains it as property, styelet IoC inject it without a problem. For example:However, if class A itself is a property of class B, stylet IoC does not inject
INotification
forAProperty
if I only registerB
.Is this behavior expected? Do I need explicitly bind
A
as well in order for Stylet IoC to injectINotification
like this?Beta Was this translation helpful? Give feedback.
All reactions