How to use Generic Method with Dapper?

Asked

Viewed 462 times

1

I have 2 methods from a generic repository

public TEntity ObterPorId(int id)
{
    return Db.Set<TEntity>().Find();
}

public IEnumerable<TEntity> ObterTodos()
{
    return Db.Set<TEntity>().ToList();
}

but I want to use Dapper, to get a little more performance, because the method ObterTodos Entity is taking too long to bring the data.

How can I do this using Dapper?

  • 1

    Maybe the link will help you follow a path... http://www.bradoncode.com/blog/2012/12/creating-data-repository-using-dapper.html

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.