111 reputation
3
bio website anastasiosyal.com
location
age 32
visits member for 2 years, 2 months
seen Apr 11 at 10:44

Jun
13
awarded  Supporter
Nov
2
comment Manager/Container class vs static class methods
@pdr ok, I see where you're getting at.I guess it all boils down to, does the widgetContainer have any state. If it does not have any state, it can be registered in an IoC container which will serve up transient instances of it that enable the consumption of the exposed methods. I see the widget container as a pretty much stateless class with a dependency on some sort of data store. As such it can live in IoC. Without additional info it's a bit hard to say. But I wouldn't rule out IoC based on the assumption that 'its got to be a single instance' as there doesn't seem to be such a requirement
Nov
2
comment Manager/Container class vs static class methods
The default behaviour for register in an IoC is not for registering single instance, but what is known as a transient lifecycle. It will serve up a new instance of a widget handler whenever resolve is called. The posted sample in the question seems very 'crudy' as if querying some sort of data store. Either Active record or Repository can apply, in which case I would point to here
Nov
2
awarded  Editor
Nov
2
awarded  Teacher
Nov
2
revised Manager/Container class vs static class methods
added 346 characters in body
Nov
2
answered Manager/Container class vs static class methods