locked
Can EF use generics like NHibernate? RRS feed

  • Question

  • In NHibernate we can access data using generics, like

       _session.Get<T>(id);
    or
       _session.Linq<T>();

     

    In EF it looks like we're always supposed to refer to concrete classes, like
       context.Employees.Add(employee);

     

    Is there any way to refer to EF classes using generics like we do with NHibernate?  I haven't found anything like that yet.

    And on a related note, is there any way to traverse the entity model at runtime?  Because even if the 1st question doesn't lead anywhere, then perhaps I could still use the entity model to hack my way to a solution.

     

    Thanks,

    Vince

     

    Monday, November 1, 2010 5:36 PM

Answers