I am trying to implement a shared repository using an entity framework.
My repository is defined as:
public class GenericRepository<T> : IRepository<T> where T : class
I want to add a generic GetByID, where the type of ID passed is also generic. I really don't want my business logic to tell me what type ... for example,
_repository.GetByID<int>(123);
I want to hide the definition of tyoe, but I can not understand where and how to do it.
Most posts in Stackoverflow seem to have their ID as int. I do not want this, since your identifiers will not always be ints!
Any ideas on this issue?
source
share