.net Microsoft.Practices.ServiceLocation 来自哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3992072/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 14:50:16  来源:igfitidea点击:

Where does Microsoft.Practices.ServiceLocation come from?

.netenterprise-library

提问by Andrew Savinykh

Does any one know where Microsoft.Practices.ServiceLocationcomes from? This is a namespace and a dll used in MS EnterpriseLibrary. Admittedly it's a very simple dll with just a handful of classes (using reflector), but I can't find published source code for it. It's not in Enterprise Library project and not in Unity project.

有谁知道Microsoft.Practices.ServiceLocation出处吗?这是 MS EnterpriseLibrary 中使用的命名空间和 dll。诚然,这是一个非常简单的 dll,只有少数几个类(使用反射器),但我找不到它的已发布源代码。它不在 Enterprise Library 项目中,也不在 Unity 项目中。

So does someone know if the source code for this was published and where? And also why is it not part of Unity? Is it used anywhere else?

那么有人知道它的源代码是否已发布以及在哪里发布?还有为什么它不是 Unity 的一部分?它在其他地方使用吗?

采纳答案by Julian Dominguez

It comes from: https://github.com/unitycontainer/commonservicelocator

它来自:https: //github.com/unitycontainer/commonservicelocator

From the project description:

从项目描述:

The Common Service Locator library contains a shared interface for service location which application and framework developers can reference. The library provides an abstraction over IoC containers and service locators. Using the library allows an application to indirectly access the capabilities without relying on hard references. The hope is that using this library, third-party applications and frameworks can begin to leverage IoC/Service Location without tying themselves down to a specific implementation.

Common Service Locator 库包含一个用于服务定位的共享接口,应用程序和框架开发人员可以引用该接口。该库提供了对 IoC 容器和服务定位器的抽象。使用该库允许应用程序在不依赖硬引用的情况下间接访问这些功能。希望通过使用这个库,第三方应用程序和框架可以开始利用 IoC/Service Location,而无需将自己绑定到特定的实现。

This abstraction is implemented by several IoC frameworks out there, and Unity is one of them. nevertheless, Unity is not the owner of that project.

这种抽象是由几个 IoC 框架实现的,Unity 就是其中之一。尽管如此,Unity 并不是该项目的所有者。

This way StructureMap, for example, provides implementation of those clases, so other frameworks (such as Prismfrom patterns & practices) can easily work with other IoC frameworks and not be bound to Unityitself.

例如,以这种方式StructureMap提供了这些类的实现,因此其他框架(例如模式和实践中的Prism)可以轻松地与其他 IoC 框架一起工作,而不受Unity本身的约束。

回答by Leniel Maccaferri

If you want you can grab the NuGetpackage here:

如果你愿意,你可以在NuGet这里获取包裹:

http://www.nuget.org/packages/CommonServiceLocator/

http://www.nuget.org/packages/CommonServiceLocator/

回答by Vladimir Savinov

Its a part of Enterprise Library : http://msdn.microsoft.com/en-us/library/ff664629(PandP.50).aspx.

它是企业库的一部分:http: //msdn.microsoft.com/en-us/library/ff664629(PandP.50).aspx

Download it, together with documentation, from http://entlib.codeplex.com/.

http://entlib.codeplex.com/下载它和文档。