Dear all
I create Entity Framework then I insert my table to it (Employee)
I can retrieve all data in Employee table using the following :
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
}
[WebGet]
public int GetCount(string where)
{
return String.IsNullOrEmpty(where) ? CurrentDataSource.Employee.Count() :
CurrentDataSource.Employee.Where(where).Count();
}
}
Aspx code
My question is if i want to retrieve employee by id or by name How can i do that?
also if this method of client side is fast way to retrieve data from DB or there is another methods?
Thanks
I create Entity Framework then I insert my table to it (Employee)
I can retrieve all data in Employee table using the following :
public class WcfDataService : DataService<CRMSEntities>{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
}
[WebGet]
public int GetCount(string where)
{
return String.IsNullOrEmpty(where) ? CurrentDataSource.Employee.Count() :
CurrentDataSource.Employee.Where(where).Count();
}
}
Aspx code
<ClientSettings>
<DataBinding Location="../WcfDataService.svc" SelectCountMethod="GetCount">
<DataService TableName="Employee"/>
</DataBinding>
</ClientSettings>My question is if i want to retrieve employee by id or by name How can i do that?
also if this method of client side is fast way to retrieve data from DB or there is another methods?
Thanks