Is it possible with Generics to get an object from my EntityFramework without knowing the type?
I\'m thinking of something along the lines of:
public
I think this could help
public static TEntity Find(this ObjectSet set, object id) where TEntity : EntityObject
{
using (var context = new MyObjectContext())
{
var entity = set.Context.CreateObjectSet();
string keyName = entity.FirstOrDefault().EntityKey.EntityKeyValues.FirstOrDefault().Key;
return entity.Where("it." + keyName + " = " + id).FirstOrDefault();
}
}