UnityContainer.Resolve or ServiceLocator.GetInstance?

后端 未结 3 1732
北恋
北恋 2021-02-01 23:57

It could seem a stupid question because in my code everything is working, but I\'ve registered a singleton this way with my Unity container _ambientContainer:

3条回答
  •  悲哀的现实
    2021-02-02 00:42

    Preferably you should avoid both ways of (ab)using your container.

    The ServiceLocator is considered an anti-pattern in modern application architecture.

提交回复
热议问题