samedi 21 mai 2016

How to query over an entity with a class name is a string?

Is there a way to query over an entity if the entity name is given as a string? In the example below it is obvious that the "className" needs to be converted to the target class, but i could not figure out how to do that by reflection...

private TEntity GetEntity(string className, Guid id)
{

     var entity = Session.QueryOver<className>().FirstOrDefualt(e => e.Id == id);

     return entity;

}





Aucun commentaire:

Enregistrer un commentaire