Replies: 2 comments
-
For the second question, I think I got the answer by going over your excellent manual N+1 times :)
And then pass
Just want to say that the more I used your framework, the more "wow"s I shouted! Thank you so much for your great work! |
Beta Was this translation helpful? Give feedback.
-
Nothing built in, but it's pretty easy with reflection. foreach (var type in someAssembly.GetTypes().Where(x => typeof(Screen).IsAssginableFrom(x)))
{
builder.Bind(type).ToSelf().InSingletonScope();
}
Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For example, my shellview managers a dozens of viewmodels which are all sub-classes of
Screen
, all those viewmodels needs to be singleton, I could explicitly configure them asIt works, but is not elegant. Is it possible to instruct IoC to use singleton scope for all classes that is derived from base class
Screen
?Another questions is if Stylet IoC can do lazy instantiation? Use the above example, the shellview manages a dozens of tabs (each tab corresponds to one viewmodel and only one tab will be active at a time) and some of tabs are computation intensive while some of tabs are merely user settings. To have good user experience, I don't want all of the viewmodels being instantiated when I launch shellview since I might only need work with user settings tabs. What's the best way to handle such situations?
Beta Was this translation helpful? Give feedback.
All reactions