Simple things as soon as you know.
A few things to know:
Currently, DataServiceClientGenerator (which uses EntityClassGenerator) does not create methods for utility operations.
Using the CreateQuery method in the context is not supported for official operations, they currently work because there is no client-side validation for this (you will notice that if you use CreateQuery, a "()" is added to the end of the request method like this http : //localhost/service.svc/method ()? parameter = 2 ", you can use CreateQuery, but this is not recommended.
Not all utility operations return values, but for this example I will show only an example for those that do.
public partial class NorthwindEntities { public IQueryable<Order> OrdersByRegion(int regionId) { return this.Execute<Orders>(new Uri(string.Format("{0}OrdersByCountry?regionId={1}", this.BaseUri, regionId), UriKind.RelativeOrAbsolute)); } }
If you need more information, you can ask any questions.
PS: In your example, you do not need to create a new data context in your service (on the server side), the DataService already has a link created when the service was called.
In fact, you can override the creation of a data context on the service side as follows:
protected override NorthwindEntities CreateDataSource() { return new NorthwindEntities(); }
source share