dimanche 21 octobre 2018

passing entity type as parameter in linq

How would I go about passing an entity type as a parameter in linq?

For e.g. The method will receive the entity name value as a string and I would like to pass the entity name to the below linq query. Is it possible to make the linq query generic ?

var entityResults = context.EntityType.Where(r => r.Prop1 == true);

I would like to pass the Entity type as a parameter and return all property values.

Also, is it possible to filter results based the some property?





Aucun commentaire:

Enregistrer un commentaire