As discussed here, C# doesn't support generic attribute declaration. So, I'm not allowed to do something like:
[Audit<User> (UserAction.Update)]
public ActionResult SomeMethod(int id){ ...
that would fit like a charm in my attribute impl class, cause I need to call a method from a generic repository:
User fuuObj = (User) repository.LoadById<T>(_id);
I tried to use this solution without success. I can pass something like typeOf(User)
, but how can I call LoadById
just with type or magic string?
*Both, T and User, extend a base class called Entity.