我有两个项目,其中一个是Web API,另一个是共享项目。要注册我的服务我使用:如何从共享项目中获取类型
var serviceType = typeof(IService);
var allTypes = Assembly.GetExecutingAssembly()
.GetTypes()
.Where(x => serviceType.IsAssignableFrom(x))
.ToList();
但是,来自共享项目的服务没有获得注册。
如何从共享项目中获取类型?
typeof(IService);意味着你得到的不是类的接口类型。你确定服务类型是否需要接口或类? –
我很确定我需要继承IService的所有接口 – nelly2k
它可能有助于检查此问题.https://stackoverflow.com/questions/34741727/example-of-using-shared-services-prism –