简体   繁体   English

在服务定位器模式中查找具体类的位置

[英]Finding location of the Concrete Class in a Service Locator Pattern

Is there an easy way to find the concrete classes assembly location or name when using the 使用时是否有一种简单的方法来查找具体类的程序集位置或名称

Service Locator Pattern without running the containing solution? Service Locator Pattern未运行包含的解决方案?

Working in a library of significant size it is difficult to find the implementation which the Service Locator returns. 在庞大的库中工作,很难找到服务定位器返回的实现。

Is there an easy way I can find the types location given a Interface or by any other means (C#)? 有没有简单的方法可以找到给定接口或通过其他任何方式(C#)的类型位置?

For example, what is the location of the implementation that of IOrder that is returned? 例如,返回的IOrder的实现的位置在哪里?

_iOrder = ServiceLocator.GetService<IOrder>();

Edit: Can this be done outside of the containing solution, by using a console app for example? 编辑:例如,可以通过使用控制台应用程序在包含的解决方案之外完成此操作吗?

_iOrder = ServiceLocator.GetService<IOrder>();
string fullName = _iOrder.GetType().AssemblyQualifiedName;

这应该提供所需的详细信息:

var fullName = _iOrder.GetType().FullName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM