Code Snippets for Common Tasks in Ado.net Data Services

Code Snippets for Common Tasks in Ado.net Data Services

  • Comments 4

[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

QueryInterceptor_1
    

   2. Fill in the EntitySet Name for the Query Interceptor

QueryInterceptor_2

Method 2 :
  1. Press the Key Combination : CTRL+K+X
  2. Select “My Code Snippets
  3. Select the option “Create a Query Interceptor for an Entity Set
  4. QueryInterceptor_3
  5. 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

 ChangeInterceptor_1
    

   2. Fill in the EntitySet Name for the Query Interceptor

ChangeInterceptor_2

Method 2 :
  1. Press the Key Combination : CTRL+K+X
  2. Select “My Code Snippets
  3. Select the option “Create a Change Interceptor for an Entity Set
  4. ChangeInterceptor_3
  5. 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.

Attachment: AstoriaServerSnippets.snippet
Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post
Page 1 of 1 (4 items)