1. What is Ado.net Data Services ?
Ado.Net Services formaly known as “Astoria“. It’s a facility that is used as a web services over net just like simple http with well known data format like jason or XML.
It’s a feature that allow user to mainuplate, traverse data through simple URIs. This allow easy access of data. The concept comes from general programming concept reffered as REST.It is avalilable with Vs 2008 + SP1.According to me I found only one and most important point that it is easily navigate through url.
Which is best feature.
2. What it requires to run it ?
For this you have to install vs2008’s service pack 1 which is easily available at
3) Basic Example for understanding :-
Here I am going to explain an example just follow the same way for initital starting. Just follow below step.
Add new web project
Step 2:- Now add a new item “Ado.net Data Service” as shown in below fig when you add it. It adds a new item in your project just like I added “RajatDataService.svc”
By default you get shared method which is initializeService
Step3:- Add new item Ado.net Entity model as shown in below fig.
Once you add it then you will get screen like below fig it has edmx extention.
Before going further I just explain you in breif edmx “Ado.net entity model ” is just like Your linq mapper with extended functionality I will explain this later on in my new
Post. But for current point of time just think as ORM.
Step4 :- Once you done with this you have to do following code in your DataService.svc.vb file’s default shared method as we said in step 2
Public Class RajatAdoNetService
Inherits DataService(Of MedicalProEntities)
‘The medical proEntries is your model entry class
‘ This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As IDataServiceConfiguration)
‘ TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
config.SetEntitySetAccessRule(“*” , EntitySetRights.AllRead)
‘ above line is use for access rules for entities in model
‘if you want to access particular entity (table) from database then just give entity name at the place of * like below
‘ The second option is for mainly giving rights like , read ,write,delete etc on entity set
‘ The above line is service opration accessRules in this again just put * int first parameter, and all in second parameter
Once you done with above code just set your .Svc page as set as start page and run the application. And you will be supprise you will get below screen
You will find in the above fig that all the tables are with in xml format. URL (
Now suppouse you want to access particular table database then you have to write fllowing url in addressbar
Then if you are not able to view data and get bleow screen
Then go to Internet explore option Tools –> Internet options –> Content tab ‘s Feed setting option and uncheck all the checkbox then
Refresh you will get fllowing screen
Simillarly you can access any entity in entity model or we can say any table from url.
Suppose I want to access product table then I have to write
I this way we can get table with data in xml format as shown above.
Where 36 is identity column value.
Step 8: if you want to access particular id’s column field’s value then you have to write column name also in url suppose I want tblbank’s strbankCode column value where id = 36 then I have to write below url
As shown below
I know this is not enough for your hunger even my too so don’t worry i will come up with more suitable example and live demo soon here I hope you people got basic understanding. I will come up with latest example and more description in next chapters
Till then enjoy the code.
Keep Shining & Keep Pushing , Keep programming
Step 7:- if you want to access particular id data then you have to write following url