This is a migrated thread and some comments may be shown as answers.

QueryInterceptor

1 Answer 39 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
DAlzoubi
Top achievements
Rank 1
DAlzoubi asked on 11 Dec 2014, 04:46 PM
Am using latest ORM WCF Data services odata 3.0 and would like to implement authorization. I could not find where i should write QueryInterceptor.
In EntitiesModelService.svc.cs i have only InitializeService method!

Where i can write below code?

[QueryInterceptor("Orders")]
public Expression<Func<Order, bool>> OnQueryOrders()
{
// Filter the returned orders to only orders  
// that belong to a customer that is the current user. 
return o => o.Customer.ContactName ==
HttpContext.Current.User.Identity.Name;
}

1 Answer, 1 is accepted

Sort by
0
Kaloyan Nikolov
Telerik team
answered on 16 Dec 2014, 12:52 PM
Hi Marshal,

The Telerik Data Access Data services work like the regular services, so you should place you example code in the same class. As those classes are generated by the wizard the right place for you custom code is in a partial class.

Please make sure that your partial class is with the same namespace with the one generated by the wizard. 

I hope this helps. Should you have any further questions do not hesitate to get back to us. 

Regards,
Kaloyan Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Development (API, general questions)
Asked by
DAlzoubi
Top achievements
Rank 1
Answers by
Kaloyan Nikolov
Telerik team
Share this question
or