C# 使用泛型打开类型参数连接StructureMap

C# 使用泛型打开类型参数连接StructureMap,c#,.net,structuremap,C#,.net,Structuremap,如何将StructureMap与以下内容连接起来: public Interface IRepository<T, TIdentity>{} public abstract class Repository<T, TIdentity> : IRepository<T, TIdentity>, other interfaces 公共接口IRepository{} 公共抽象类存储库:IRepository,其他接口 我有许多存储库的具体实现,需要Structu

如何将StructureMap与以下内容连接起来:

public Interface IRepository<T, TIdentity>{}
public abstract class Repository<T, TIdentity> : IRepository<T, TIdentity>, other interfaces
公共接口IRepository{}
公共抽象类存储库:IRepository,其他接口
我有许多存储库的具体实现,需要StructureMap自动连接它们

public class JournalRepository : Repository<Journal,int>{}
public class UsersRepository : Repository<Users,int>{}
public class AccountGroupsRepository : Repository<Accounts,string>{}
public类JournalRepository:Repository{}
公共类UsersRepository:存储库{}
公共类AccountGroupsRepository:存储库{}
等等

我试过:

 x.ForRequestedType(typeof(IRepository<,>))
.TheDefaultIsConcreteType(typeof(Repository<,>));
x.ForRequestedType(typeof(IRepository))
。默认混凝土类型(类型(存储库));
但我只得到StructureMap异常代码:25(没有解释)

这有可能吗

非常感谢
Jeremy

我认为,通过使用以下工具,可以获得内置支持:

Scan(assemblyScanner =>
             {
                 assemblyScanner.TheCallingAssembly();
                 assemblyScanner.AddAllTypesOf(typeof (IRepository<>));
                 assemblyScanner.ConnectImplementationsToTypesClosing(
                    typeof(IRepository<>));
             });
Scan(组装扫描仪=>
{
装配扫描仪。装配总成();
assemblyScanner.AddAllTypesOf(typeof(IRepository));
assemblyScanner.ConnectionImplementationsToTypesClosing(
类型(假定的);
});

Jeremy,添加一个编程语言标签,我会帮你做的,但我不善于猜测;)这将增加你的问题的可视性和答案的数量!你是说像C#?我还没有意识到这是必要的——非常感谢——我只是希望我能找到StructureMap的文档。这些文档可以在网站上找到,否则谷歌集团通常会很有帮助