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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -