Jaa


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

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.

AstoriaServerSnippets.snippet

Comments

  • Anonymous
    August 11, 2008
    PingBack from http://www.easycoded.com/code-snippets-for-common-tasks-in-adonet-data-services

  • Anonymous
    August 11, 2008
    You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • Anonymous
    October 01, 2008
    We can't download the snippet because the company I work at blocks Skydrive.  Can you make it a CodePlex project?

  • Anonymous
    October 01, 2008
    Hi David, I posted an alternate download link at the bottom of the post. Regarding making this a codeplex project, at the moment , I dont think I will be able to dedicate any time to maintaining a codeplex project . Once time frees up , I will put this and other samples up on codeplex . -Phani