Это абсолютно возможно. Но вы должны перенести запросы на сайт репозитория и реализовать один репозиторий на класс. Например:
public abstract class GenericRepository : IRepository {
public virtual T Get<T>(Identity id) where T : PersistentDocument {
using (IDbConnection connection = GetConnection())
using(IDbCommand command = CreateGetCommand(id, connection)) {
using (IDataReader reader = command.ExecuteReader()) {
var mapper = DaHelper.GetMapper<T>();
return mapper.Map(reader);
}
}
}
protected virtual IDbCommand CreateGetCommand(Identity id, IDbConnection connection) {
IDbCommand command = connection.CreateCommand();
command.CommandText = String.Format("SELECT * FROM {0} e WHERE e.id = ?", TableName);
command.Parameters.Add(id.ToGuid());
return command;
}
protected abstract string TableName { get; }
}
public class UserRepository: GenericRepository<User>, IUserRepository
{
protected override string TableName { get { return "users"; } }
public User GetByEmail(string email)
{
using (IDbConnection connection = GetConnection())
using (IDbCommand command = connection.CreateCommand())
{
command.CommandText = String.Format("SELECT * FROM {0} e WHERE e.email = ?", TableName);
command.Parameters.Add(email);
using (var reader = command.ExecuteReader())
return DaHelper.GetMapper<T>().Map(reader);
}
}
}