I'm having a Service it returns the data of type List<Boss>
.
This Question is Purely depends on Service Call, not a DB Context
The Model Classes are
public class Boss
{
public int ID { get; set; }
public int SID { get; set; }
public string Name { get; set; }
public string Department { get; set; }
public string Gender { get; set; }
public string Role { get; set; }
public List<Person> Employees { get; set; }
}
public class Person
{
public int ID { get; set; }
public int SID { get; set; }
public string Name { get; set; }
public string Department { get; set; }
public string Gender { get; set; }
public string Role { get; set; }
public List<PayrollInfo> PayInfo { get; set; }
}
public class PayrollInfo
{
public int Monthof2015 { get; set; }
public int NetWorkingDays { get; set; }
public int AbsentDays { get; set; }
}
Just Imagine the Service
[OperationContract]
List<Boss> GetDataMale();
Outline of the Method should be
public List<Boss> GetDataMale()
{
using(var db = new DBContext)
{
return db.Boss.Where(x => x.Gender == "Male").ToList();
}
}
Now Consider the Client Side:
using(var client = new ServiceProvider())
{
var bListEnum = client.GetDataMale().AsEnumerable().Where(m => m.Role == "Manager");
var bListQuery = client.GetDataMale().AsQueryable().Where(m => m.Role == "Manager");
}
Let I know which one is preferable in Client ? Kindly explain the operational differentiation of these two statements.
var bListEnum = client.GetDataMale().AsEnumerable().Where(m => m.Role == "Manager"); var bListQuery = client.GetDataMale().AsQueryable().Where(m => m.Role == "Manager");