c# - Using Entity Framework Efficiently -
c# - Using Entity Framework Efficiently -
i'm using entity framework in asp.net mvc project. need know if i'm dealing correctly next scenario.
lets employee table has on 100000 records , have apply various filtering according client requirement.
so write 1 method readall() retrieve records database , apply filtering datasource using lambda expressions.
ex: employee id
public list<employee> readall() { // homecoming list<employee> } private employee(int id) { employee obj=readall().where(o=>o.empid == id).first(); }
i'm trying utilize 1 read method because there various filtering applied , not have write separate database access methods each of them.
will impact application performance adversely?
change readall homecoming iqueryable won't execute query until after you've applied filter , called first() or tolist().
public iqueryable<employee> readall() { // homecoming list<employee> }
entity framework uses concept called deferred execution. encourage read on it.
c# asp.net asp.net-mvc linq entity-framework
Comments
Post a Comment