在我的解决方案中,我有三个这样的项目。

我将 Common.dll 和 Service.dll 复制到 d:\libs 之类的文件夹中,并使用下面的代码进行类型扫描
ObjectFactory.Initialize(x =>
{
x.Scan(xx =>
{
xx.AssembliesFromPath(@"d:\libs");
xx.LookForRegistries();
});
});
//I have PersonService that implement IPersonService
namespace Common
{
public interface IPersonService
{
string SayHello(string name);
}
}
namespace Services
{
public class PersonService : IPersonService
{
public string SayHello(string name)
{
return string.Format("Hello {0}", name);
}
}
}
当我想从 IPerson 获取实例时初始化我的依赖项后,我收到此错误
var personService = ObjectFactory.GetInstance<IPersonService>();
{"未注册默认实例且无法自动确定类型 'Common.IPersonService'\r\n\r\n没有为 Common.IPersonService 指定配置\r\n\r\n1.) Container.GetInstance(Common .IPersonService)\r\n"}