泛型类型StructureMap自动注册我有一个接口:使用扫描
IRepository<T> where T : IEntity
,而即时通讯使用一些假信息库实现,刚刚返回任何旧的数据敲开了我的UI IM。
他们看起来像这样:
public class FakeClientRepository : IRepository<Client>
目前IM这样做:
ForRequestedType<IRepository<Client>>()
.TheDefaultIsConcreteType<FakeRepositories.FakeClientRepository>();
我所有IEntities负荷次,但。是否有可能使用扫描自动注册所有我的假的存储库为其各自的IRepository?
编辑:这是据我得到的,但我得到的错误说法请求类型的心不是注册:(
Scan(x =>
{
x.TheCallingAssembly();
x.IncludeNamespaceContainingType<FakeRepositories.FakeClientRepository>();
x.AddAllTypesOf(typeof(IRepository<>));
x.WithDefaultConventions();
});
感谢
安德鲁
很酷,看起来像是正确的事情,生病明天检查出来 – 2009-02-05 18:27:16