Introduction to WCF Data Services and RESTful Web Services
Discover the fundamentals of WCF Data Services and REST (Representational State Transfer) through a comprehensive agenda. This informative guide highlights key concepts such as OData, HTTP verbs, data models, and more, providing practical examples in C#. Learn how to create, retrieve, update, and delete records using the DataServiceContext in WCF. Engage with real-world applications demonstrated in flow diagrams and demos, making complex data interactions accessible and understandable.
Introduction to WCF Data Services and RESTful Web Services
E N D
Presentation Transcript
http://dhananjaykumar.net DEBUGMODE_ Introducing WCF DATA SERVICE Dhananjay Kumar
Agenda http://dhananjaykumar.net/
What is REST ? REST == Representational State Transfer http://dhananjaykumar.net/
WCF Data Service http://dhananjaykumar.net/
WCF Data Service http://dhananjaykumar.net/
ODATA http://dhananjaykumar.net/
ODATA Consumer and Producer CONSUMER PRODUCER http://dhananjaykumar.net/
WCF Data Service http://dhananjaykumar.net/
HTTP Verbs http://dhananjaykumar.net/
Message format http://dhananjaykumar.net/
Data Model http://dhananjaykumar.net/
Flow diagram http://dhananjaykumar.net/
DEMO http://dhananjaykumar.net/
URI options http://dhananjaykumar.net/
Create Record DataServiceContext context = newDataServiceContext(newUri("http://localhost:7003/WcfDataService1.svc/")); Blogger blog = newBlogger { SpeakerId = 99, SpeakerBlog = "null", SpeakerName = "Mr Bill ", SpeakerTechnology = "Microsoft" }; context.AddObject("Bloggers", blog); context.SaveChanges(); http://dhananjaykumar.net/
Retrieve Record DataServiceContext context = newDataServiceContext(newUri("http://localhost:7003/WcfDataService1.svc/")); SpeakersEntities entities = newSpeakersEntities(newUri("http://localhost:7003/WcfDataService1.svc/")); var result = from r inentities.Bloggersselect r; foreach (var r in result) { Console.WriteLine(r.SpeakerName+ r.SpeakerTechnology); } http://dhananjaykumar.net/
Update Record DataServiceContext context = newDataServiceContext(newUri("http://localhost:7003/WcfDataService1.svc/")); SpeakersEntities entities = newSpeakersEntities(newUri("http://localhost:7003/WcfDataService1.svc/")); BloggerblogtoUpdate = (from r inentities.Bloggerswherer.SpeakerId== 9 select r).FirstOrDefault(); blogtoUpdate.SpeakerTechnology = "C Sharp "; context.AttachTo("Bloggers", blogtoUpdate); context.UpdateObject(blogtoUpdate); context.SaveChanges(); http://dhananjaykumar.net/
Delete Record DataServiceContext context = newDataServiceContext(newUri("http://localhost:7003/WcfDataService1.svc/")); SpeakersEntities entities = newSpeakersEntities(newUri("http://localhost:7003/WcfDataService1.svc/")); BloggerblogtoUpdate = (from r inentities.Bloggers wherer.SpeakerId == 99 select r).FirstOrDefault(); context.AttachTo("Bloggers", blogtoUpdate); context.DeleteObject(blogtoUpdate); context.SaveChanges(); http://dhananjaykumar.net/
WCF Data Service http://dhananjaykumar.net/
With W7Phone http://dhananjaykumar.net/
http://dhananjaykumar.net DEBUGMODE_ Q & A Dhananjay Kumar