Code Snippets for Common Tasks in Ado.net Data Services
[These code snippets are based on features in the SP1 RTM release, Read about it here : RTM is here! ]
Quite a few times, I forget the syntax for certain tasks while Creating a Data Service .
To avoid remembering the syntax, I came up with a couple of Code Snippets that I use for Query Interceptors and Change Interceptors.
You can download the Code Snippets Here
[Edit : Alternate download link at the bottom of the post .]
Using the Code Snippets
1) Copy the above files into the
%systemDrive%:\Users\<UserName>\Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets
folder.
2) Open Visual Studio and open the .SVC.CS file for the Data Service.
Using the Query Interceptors Snippet
Method 1 :
1. Type in qi and press tab twice
2. Fill in the EntitySet Name for the Query Interceptor
Method 2 :
- Press the Key Combination : CTRL+K+X
- Select “My Code Snippets”
- Select the option “Create a Query Interceptor for an Entity Set”
- Fill out the Entity Set Name and you should be good
Using the Change Interceptors Snippet
Method 1 :
1. Type in ci and press tab twice
2. Fill in the EntitySet Name for the Query Interceptor
Method 2 :
- Press the Key Combination : CTRL+K+X
- Select “My Code Snippets”
- Select the option “Create a Change Interceptor for an Entity Set”
- Fill out the Entity Set Name and you should be good
In a future post , I will share the Client Code Snippets that I use for common Client Tasks with the astoria client library.