인터페이스가있어서 매개 변수 제약 조건이있는 클래스가있는 메서드를 포함하고 싶습니다. 당신은 인터페이스 decleration에 제약 조건을 포함 할 필요가 없습니다 그런 식으로 그것을 만드는 방법으로 가능한가요?인터페이스 메서드 및 매개 변수 제약
public interface IPlugin
{
void InitializeSession(MBROContext context, Reporter<TEntity, TContext> reporter);
}
TEntity는 IEntity에서 상속 한 클래스입니다. TContext는 IDbcontext로부터 상속 한 DbContext입니다.
public class Reporter<TEntity, TContext> where TEntity : class, IEntity where TContext : IDbContext, IDisposable, new()
{
private IUnitOfWork uow;
private IRepository<TEntity> entryRepository;
private IService<TEntity> entryService;
public Reporter()
{
this.uow = new UnitOfWork<TContext>();
this.entryRepository = uow.GetRepository<TEntity>();
this.entryService = new Service<TEntity>(this.uow);
}
public void Dispose()
{
throw new NotImplementedException();
}
}
나는이 말이 희망을 다음과 같이
기자 클래스의 서명입니다.
이것은 정확하게 내 대답이 제안한 것입니다 ... – Servy
그 이유는 그것을했습니다 : - P는 –