如何向 SimpleIOC 注册通用存储库?
public interface IRepository<T>
{
}
public class Repository<T> : IRepository<T>
{
}
SimpleIoc.Default.Register<IRepository, Repository>(); //Doesn't work, throws error
Error 1 Using the generic type 'AdminApp.Repository.IRepository<TModel>' requires 1 type arguments C:\Application Development\AdminApp\AdminApp.Desktop\ViewModel\ViewModelLocator.cs 55 44 AdminApp.Desktop
我也试过:
SimpleIoc.Default.Register<IRepository<>, Repository<>>(); //Doesn't work either
Error 1 Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement C:\Application Development\AdminApp\AdminApp.Desktop\ViewModel\ViewModelLocator.cs 55 17 AdminApp.Desktop