Register Generic Type with Autofac
问题 I have UnitofWork class and it implement IUnitOfWork. I try to register that with autofac : var builder = new ContainerBuilder(); builder .RegisterGeneric(typeof(UnitOfWork<Repository<>,>)) .As(typeof(IUnitOfWork)) .InstancePerDependency(); Implementation is: public class UnitOfWork<T, O> : IUnitOfWork where T : Repository<O> where O : BaseEntity { } public interface IUnitOfWork : IDisposable { void SaveChanges(); } Gives an error "Type expected" but this one work on another project: public