Working with the DNN Service Framework
Upcoming SlideShare
Loading in...5
×
 

Working with the DNN Service Framework

on

  • 1,250 views

As a consultant, I am often times asked to move the sun and stars for clients in a short amount of time. Often times, this means creating creative solutions to expose data from existing 3rd party DNN ...

As a consultant, I am often times asked to move the sun and stars for clients in a short amount of time. Often times, this means creating creative solutions to expose data from existing 3rd party DNN which do not offer a rich API for me to work with. With technologies such as Knockout and Backbone, having a rich JSON service to access data from 3rd party DNN modules allows me to deliver the ''impossible'' for clients. In past years hacks such as creating generic handlers have been used to create an API, but recently DNN has included a framework which extends the Microsoft Web API and makes delivering data from your module, or other DNN modules a snap. In this session we will explore the tools and strategies for exposing a rich API within your DNN project.

Statistics

Views

Total Views
1,250
Views on SlideShare
1,250
Embed Views
0

Actions

Likes
0
Downloads
6
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Working with the DNN Service Framework Working with the DNN Service Framework Presentation Transcript

  • Working With the DNN Service Framework Saturday, October 19, 13
  • Working With the DNN Service Framework Saturday, October 19, 13
  • THANKS TO ALL OF OUR GENEROUS SPONSORS! Saturday, October 19, 13
  • Gravity Works DNNCon Contest #gwDNNContest First Place: $100 gift card to Best Buy Runners Up: Two $25 gift cards ThinkGeek 2 Steps to Win: 1) Follow Gravity Works Design & Development on Twitter @gravityworksdd 2) Complete the 3 challenges announced from our account throughout the day & submit your visual proof by tweeting photos to @gravityworksdd with the hashtag #gwDNNContest Last entry by 4pm Winners announced & prizes awarded at Closing Ceremonies Saturday, October 19, 13
  • Gravity Works DNNCon Contest #gwDNNContest First Place: $100 gift card to Best Buy Runners Up: Two $25 gift cards ThinkGeek 2 Steps to Win: 1) Follow Gravity Works Design & Development on Twitter @gravityworksdd 2) Complete the 3 challenges announced from our account throughout the day & submit your visual proof by tweeting photos to @gravityworksdd with the hashtag #gwDNNContest Last entry by 4pm Winners announced & prizes awarded at Closing Ceremonies Saturday, October 19, 13
  • THANKS TO ALL OF OUR GENEROUS SPONSORS! Saturday, October 19, 13
  • The Old Way http://ditchnet.org/httpclient/ http://fiddler2.com/ http://discover-devtools.codeschool.com/ http://msdn.microsoft.com/en-us/library/ms973893.aspx Saturday, October 19, 13
  • The Old Way <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"> <!-- Envelope, header and body --> <xs:element name="Envelope" type="tns:Envelope" /> <xs:complexType name="Envelope" > <xs:sequence> <xs:element ref="tns:Header" minOccurs="0" /> <xs:element ref="tns:Body" minOccurs="1" /> <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" /> </xs:sequence> <xs:anyAttribute namespace="##other" processContents="lax" /> </xs:complexType> http://ditchnet.org/httpclient/ http://fiddler2.com/ http://discover-devtools.codeschool.com/ http://msdn.microsoft.com/en-us/library/ms973893.aspx Saturday, October 19, 13
  • Same Origin Policy http://en.wikipedia.org/wiki/Same-origin_policy http://www.html5rocks.com/en/tutorials/cors/ http://en.wikipedia.org/wiki/List_of_HTTP_header_fields http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api Saturday, October 19, 13
  • Same Origin Policy The policy permits scripts running on pages originating from the same site—a combination of scheme, hostname, and port number—to access each other's methods and properties with no specific restrictions, but prevents access to most methods and properties across pages on different sites. Same-origin policy also applies to XMLHttpRequest and to robots.txt. context.Response.AddHeader("Access-Control-Allow-Origin", "*"); http://en.wikipedia.org/wiki/Same-origin_policy http://www.html5rocks.com/en/tutorials/cors/ http://en.wikipedia.org/wiki/List_of_HTTP_header_fields http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api Saturday, October 19, 13
  • Web API http://www.asp.net/web-api http://james.newtonking.com/json http://odetocode.com/blogs/scott/ http://haacked.com/ Saturday, October 19, 13
  • Web API public class RouteMapper : IServiceRouteMapper { public void RegisterRoutes(IMapRoute mapRouteManager) { mapRouteManager.MapHttpRoute("DNNService", "default", "{controller}/{action}", new[] { "DNNService" }); mapRouteManager.MapHttpRoute("DNNService", "GetUser", "{controller}/{action}/{portalId}/{userId}", new[] { "DNNService" }); mapRouteManager.MapHttpRoute("DNNService", "GetUsers", "{controller}/{action}/portalId}", new[] { "DNNService" }); } } http://www.asp.net/web-api http://james.newtonking.com/json http://odetocode.com/blogs/scott/ http://haacked.com/ Saturday, October 19, 13
  • DNN Context http://www.github.com/gravityworks https://bitbucket.org/gravityworks Saturday, October 19, 13
  • DNN Context [AllowAnonymous] [HttpGet] public HttpResponseMessage GetUsers(int portalId) { var allUsers = DotNetNuke.Entities.Users.UserController.GetUsers(portalId); var allMappedUsers = new List<UserInfoMap>(); foreach (UserInfo item in allUsers) { allMappedUsers.Add(new UserInfoMap(item)); } return Request.CreateResponse(HttpStatusCode.OK, allMappedUsers); } [AllowAnonymous] [HttpGet] public HttpResponseMessage ChangePassword(int portalId, int userId, string password, string newValue) { UserInfo user = DotNetNuke.Entities.Users.UserController.GetUserById(portalId, userId); var result = new DotNetNuke.Security.Membership.AspNetMembershipProvider().ChangePassword(user, password, newValue); DotNetNuke.Entities.Users.UserController.UpdateUser(portalId, user); return Request.CreateResponse(HttpStatusCode.OK, result); } http://www.github.com/gravityworks https://bitbucket.org/gravityworks Saturday, October 19, 13
  • Knockout http://www.knockoutjs.com http://learn.knockoutjs.com/ http://opendata.socrata.com/resource/2brv-dhpz.json? http://bit.ly/15SaKoT http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV361 Saturday, October 19, 13
  • Knockout <table class="table" data-bind="visible: Entrys().length>0"> <thead> <tr> <th>Name</th> <th>Status</th> <th>Pollutants</th> <th>Zip Code</th> <th>Score</th> </tr> </thead> <!--Iterate through an observableArray using foreach--> <tbody data-bind="foreach: Entrys"> <tr> <td><span data-bind="text: name"></span></td> <td><span data-bind="text: status"></span></td> <td><span data-bind="text: pollutants"></span></td> <td><span data-bind="text: zipcode"></span></td> <td><span data-bind="text: score"></span></td> </tr> </tbody> </table> http://www.knockoutjs.com http://learn.knockoutjs.com/ http://opendata.socrata.com/resource/2brv-dhpz.json? http://bit.ly/15SaKoT http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV361 Saturday, October 19, 13
  • Angular http://angularjs.org/ http://www.youtube.com/watch?v=i9MHigUZKEM http://bit.ly/17QgEJ2 http://bit.ly/19vB70M http://www.slideshare.net/gravityworksdd/ Saturday, October 19, 13
  • Angular <div ng-app> <div ng-controller="EntryCtrl"> <table> <thead> <tr> <th>Name</th> <th>Status</th> <th>Pollutants</th> <th>Zip Code</th> <th>Score</th> </tr> </thead> <tbody ng-repeat="entry in entrys"> <tr> <td>{{entry.name}}</td> <td>{{entry.status}}</td> <td>{{entry.pollutants}}</td> <td>{{entry.zipcode}}</td> <td>{{entry.score}}</td> </tr> </tbody> </table> </div> </div> http://angularjs.org/ http://www.youtube.com/watch?v=i9MHigUZKEM http://bit.ly/17QgEJ2 http://bit.ly/19vB70M http://www.slideshare.net/gravityworksdd/ Saturday, October 19, 13
  • Jeff Mcwherter Partner & Director of Development jeff@gravityworksdesign.com @jmcw Saturday, October 19, 13
  • Jeff Mcwherter Partner & Director of Development jeff@gravityworksdesign.com @jmcw Saturday, October 19, 13