我有一个像这样定义的通用接口 -
public interface IGenericRepository<TEntity, TDbContextType>
where TEntity : class
where TDbContextType : IDbContextType
该接口由这样的类实现 -
public class GenericRepository<TEntity,TDbContextType>
: IGenericRepository<TEntity, TDbContextType>
where TEntity : class
where TDbContextType: IDbContextType
我尝试了以下方法来注册这个接口和城堡的实现 -
_container.Register(Component.For(typeof (IGenericRepository<>))
.ImplementedBy(typeof (GenericRepository<>))
.LifestylePerWcfOperation());
但它在编译时失败说“参数数量不正确”。