Presenter:Mike Taulty
ADO.NET Data Services let us make data widely available through RESTful web services. In this video we take a look at how we can offer data from the ADO.NET Entity Framework, LINQ to SQL and any arbitrary data.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
A low and welcome to the sure video on 80 net data services money was my cult in with Microsoft in the UK eight other net data services he is a technology which is into editorship in 2008 and is currently preview form will give you a hyperlink at the end of the video as to where you can get the preview from essentially what it s about it is it s about servicing your data over a restful Web services and what I really mean by restful Web services services where we simply using that you I identify resource on the server are now using HTTP verb to describe what it is you want to do with that resource on the service that we can get we can put we can post and we can delete and largely corresponding to the standard drug operations expect against something like a relational database in terms of getting data back from a service you can get back as XML data
Minute 1
A moment in his comeback as the atom publishing protocol or ap protocol and or Jason data for things that Ajax applications so in terms of getting data you can use us to format in terms of updating inserting data again we accept this to format is so I do here is true how the preview works and visited his house and they just has the point where we can query some data and a house in subsequent videos about how we can build clients in that kind of thing okay so I m here in visual studio 2008 and I have the SP net version 2 5 extensions installed on my machine artery were to get that at the end of the video new project hero is a website because ultimately were doing stuff over HTTP and the going is a speed at their website in the file system will call it and video website something like that and locate their defender goes away and create a web
Minute 2
Page and that you want a webpage in this case will get rid of that and then what I do is add into this project a data source never been a look at three different and the data sources very briefly here the first data source and 90 use is going to be an eight year old net entity datamodel so this comes from a single the entity framework and is one way of servicing data into a deal that their data service sanity of my north wind database here let s just go and do that would generate from a database is the Norsemen database and will bring you all of our tables is fine and planners has been all about tables and this gives me datamodel like and then use with entity framework which is separate topic really in order to manipulate that datamodel case are not in a focus on this model here at all other than to show that we do have
Minute 3
A class called as justifying the top of this Northwind entities which contained a bunch of properties which I query balls and that specifically things like categories customers products etc etc are all returned as public properties of this class that is called Northwind entities appear while now it is surfaced this data model using video and data services will add into this project and new item lets go to a governor data service will call their son my service something like that will add that in band is generating code for as an effective river that is what it gives as a class called my service in this case that derives from a classical web data service which is a generic type and the job if you like it s too parameterised as generic type is the comment suggests underway with franchise is with the
Minute 4
At data which roses called Northwind entities such as do that and there is one more thing will have to do by default none of our data will be surfaced by the service because of security so what we can do in a simple example at this history can just say that it s anyone s to access one of our resources are any resource in our case marked by a star then will allow them to do whatever they want because it s just a demonstration to do so you can be whatever you want with one of our resources with an embrace and began to swim at like surprisingly just go and take this SCC value we can browse it is described in the van browser let the built in web servers bring up and then pop over to that rid of that to describe adding that site you can see we get a list of workspace has a bunch of collections with a correspond to the we might call the entity sets the existing datamodel and what to look ago to follow on session we can reach into the
Minute 5
And things like customers we can reach into this looking to things like orders we can reach into it looking for particular customers or disease seal the data is going back to let s pull out a particular customer but my indexing by primary key we have one called Alf Keith and there he is we can reach in and get hold of the city that I ve currently got in living in and so on and so forth date has been exposed and are surely querying here to want to realise we can do in sets of data delays I can t test those from the browser so will look at that in follow on sessions where we build clients against the services and but is this data has been exposed to the provider you are and I get back in this case XML and whether I get back XML Jason data depends on and one of the HTTP headers the accept header that sent to the service suffers doing this and Ajax aggregate Jason data back into the Maxwell light
Minute 6
As one way oh we can expose the dose was that of a different kind of data source we can expose in the same way that is about code and let s forget this is an entity framework thing that we put in here and delete it I ve had a new data source into this project and will use link to sequel which is something that shipped with is received as they done fretwork version 3 5 scoreless and Northwind and will add this in Alistair US and will let this go ahead and were a little bit and it was a design surface will go to a server explorer and will find the Northwind database will find tables in their will grab some tables from their after a couple of kind of hacking tables and should really be in were dragged into this design surface and ultimately again on a focus on link to sequel in a big way here but ultimately what we get out of this years a classless does have a blanket over s
Minute 7
Lesion explorer begetter generated code and that generated code is a class called Northwind data contact such as financial class definition there is no Sunday to complex and I like classical Northwind AT contest out in public properties which are i e query of all in the sense of have a property light and this one here called customers and another one called orders in the local products and so on and so forth to what that means you can go back to our own data service and replace Northwind entities which no longer exist with Northwind data contacts has gone rebuild it looks like I need to get rid of theto show longer exists and we built that those of you service code in a browser and you can see that we got some collections or categories in customers and so on I can reach in here looking for customers
Minute 8
I can reach him here looking for particular and customers and so on and so forth now it were saying that while such surface this date of querying and I wouldn t actually be a will to update this data and video comfort from a browser anyway but even if I had a client did an update of this violence to delete it wouldn t work and whittling to seek also out of the box you get read on the experience but you can add change that you can write in code to make that happen will look at that right here than there are articles on my website visitor is more interested in that kind of thing now you might want to service data here that doesn t that you come from entity framework or link to sequel analysis and data that you got so let s get rid of this unlinked sequel stuff you and that is add into code folders on class of her own is very simple to add a class in here would call the sun on my classes
Minute 9
Topsy Sharp and then let s just go and collapse that down otherwise you geton screen and in here let s have some class lie and on a classical person has come through that and there will have a property on there will have first name of another one last name I will have another one called them age something like that and let s does make life very easy to ourselves by having only public static method which fits a list a list of persons and them will call that and make people something like that and all will do in that method if I can just control all these using statements acute leaping onto the screen is will return the new list of person and there were these hard codes list of people saw
Minute 10
Out on a new person s first name it was bought last name Jones age equals 15th something on the one more just and good measure first name equals Jim last name because Smith age 91 something like that so with a little method it makes a list of people for us now it is another thing we need to do with person he needs some kind of key he needs some kind of identifier in order to the framework to work with him so what will do is just to add a simple property which we will call key so will go out of prop in key notices doesn t have to be an integer and what will here is an actually saying that this is the key for this particular entity so would only cassette that thrive to entities over here but say that Bob is keyed of one and let s say that Jim is key equals to have it to got that
Minute 11
Then with that in place let s go and greater other classless critic Marshall collects and on my data context and onto that what will add is public property which is high query or of persons was a high query with person and will collect people and will do in order to get this property is will return on review return person make people and is an extension method with news and n 2 5 to turn this enumeration into a query will object agreeable type so we ll do that updated at this data consisting of pop over here and change Norseman data context of my data context must build let go and view this in a browser and we should have surfaced very basic data new series collection call people we can reach in and look at the people forgotten their their coming back with Bob and Jim in their let s go look at a gym
Minute 12
So that there s a gym we can all find his son aged something like that there is Jim s age and so we surface our data as well so really does very quickly here we see that we can surface pretty much any kind of data with an 80 net data services we surface some anti framework data are we surfaced some winter sequel data that was really only without as writing more cold and we surface some arbitrary data here again this is read only without others writing some more code but hopefully see how quickly and productively we can get data out of one of his services were combatants of the videos look at building clients of the services in also around and doing modifications with the services just a quick summary on what was seen here a year and a data services these allow us to surface resources from the service I data from the service either over restful Web services interface so that is really using a seedy
Minute 13
He and the underlying verbs of HTTP in order to interact with server side resources picking a date back as XML or Jason format this line that really nicely with the AT about the entity framework and it means we can simply take classes from entity framework and surface that data immediately in a read right manner very simple to do but it wasn t a day to make a sequel we get read only on that without writing some more code or even our own data as we saw here and get read only on that without writing some more code so it s not just entity friendly data that is a model for adding additional candidate in there as well okay so if you want to download the preview and experiment with your own data you to go to do be do be do be do a speed up their your looking threatening could be a speed on a 3 5 extension is preview certainly that heavy single packaged at the time of recording this video there are a number of technologies in that preview twoofwhichradio net data services
Minute 14
The other net entity framework so remember there is preview but download that and try with your own data sources if you registered on this technology be an idiot and a data services was previously called code named Astoria and is a great blog resource it s as you can see on the screen blocks the Anthea knock on Astoria team and if you go there you can keep up to date with what s going on with this particular project and is a bunch of nice resources linked that site is well as you ve want to follow directly with me after the video then feel free to drop me a line using e mail address and screen other than that we have fun and playing with Astoria a killer net data services hobbies and the video useful and practical joke with you sometime in the future
Click here to go to original video page
Monday, July 21, 2008
Video: ADO.NET Data Services - Surfacing Data
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment