I am trying to call the below generic method dynamically where T is associated to class
and other interfaces as mentioned below. I am kind of stuck in problem on how to define those class and interfaces
while calling generic method.
this is the generic method
private async Task UpdateRevision<T>(Guid id) where T : class, IAEIMaster, IRevisionData
{
var dbSet = this._dbContext.Set<T>();
var code = dbSet.SingleOrDefault(c => c.Id == id);
int revision;
......
......
code.Revision = revision;
code.IsApproved = true;
}
and this is where i am calling the above generic method
var method = typeof(Mutation).GetMethod("UpdateRevision");
var generic = method.MakeGenericMethod("what i need to put here"); // here i have got stuck in
var task = (Task)generic.Invoke(this, new object[] { request.DataId });
// also not sure how to define class, IAEIMaster, IRevisionData here
Could any one please let me know on this how to call that generic method that would be very grateful to me, many thanks in advance
I am using .Net core with EF core
Aucun commentaire:
Enregistrer un commentaire