The FirstOrDefault extension method work properly but it aways perform a sql query with no where clausule in database returning all records!
Thanks,
Vitor
The FirstOrDefault extension method work properly but it aways perform a sql query with no where clausule in database returning all records!
Thanks,
Vitor
Why FirstOrDefault method aways gets all records from database?
JoeyRelieved
Pazu
// This performs a SQL clausule with a where clausule
// A exceptions it's returned when no results founded Enterprise enterprise = db.Enterprises.First(e => e.ID == 181);// This performs a SQL clausule with *NO* where clausule
// All database records are internally returned
Enterprise enterprise = db.Enterprises.FirstOrDefault(e => e.ID == 181);// This work ok
Enterprise enterprise = db.Enterprises.Where(e => e.ID == 181).FirstOrDefault();Ekta
Phil Nicholas