entity framework - c# How to convert from GetType() to T -
i have method receives generic t
data.helpers.entitykeyhelper.instance.getkeynames<t>(this);
where t should be:
type entitytype = dbentry.entity.gettype();
so need pass:
data.helpers.entitykeyhelper.instance.getkeynames<entitytype>(this);
but it's sending me error:
the type or namespace name 'entitytype' not found (are missing using directive or assembly reference?)
any clue on how can covert dbentry.entity t?
you can use makegenericmethod
, first need getkeynames
method then:
method.makegenericmethod(dbentry.entity.gettype()) .invoke(yourinstance, new object[] { });
Comments
Post a Comment