Development In ASP.NET by Tanzim Saqib


Published on

Tanzim Saqib presents on development tools, and features for ASP.NET developers.

Published in: Technology
1 Comment
  • cuon sach linq to sql nay rat hay
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Development In ASP.NET by Tanzim Saqib

  1. 1. Development in ASP.NETWebForms, LINQ, Dynamic Data<br />TanzimSaqib<br /><br />SaaS Developer <br />Software as-a Service (SaaS) Platform<br />British Telecom<br />
  2. 2. Session Summary<br />WebForms<br />LINQ<br />Dynamic Data<br />Futures – ASP.NET 4<br />
  3. 3. What is ASP.NET<br />Technology for web application development<br />Provides you with rich APIs and services<br />Robust, scalable, fast development experience<br />Great flexibility, less coding<br />Seamless integration with Microsoft stack tools<br />Not an upgrade from ASP<br />the next generation ASP<br />
  4. 4. WebForms<br />UI elements that make up the Look & Feel of your application<br />Also known as just Page.<br />Code behind brings UI and code separation<br />Default.aspx<br />Default.aspx.cs<br />Advanced features reduce code<br />i.e. Data binding<br />Rich Drag & Drop design experience<br />
  5. 5. WebForms (contd.)<br />Support for multiple languages<br />C#, VB, C++ and so on<br />Similar to Windows Forms programming model<br />Events, Properties, Methods<br />Extensibility<br />Third party assemblies and controls<br />runat=“server”<br />Compiled at server-side<br />Accessible by server code<br />
  6. 6. ASP.NET Controls or Web Controls<br />
  7. 7. Most Commonly Used WebControls<br />
  8. 8. ASP.NET Ecosystem<br />
  9. 9. Page Life Cycle Events<br />Events in green are the most frequently used<br />
  10. 10. Page Life Cycle Events (contd.)<br />For more information:<br />
  11. 11. WebForms Feature Highlights<br />Themes and skins<br />Master pages<br />Membership, Profile and Role Manager API<br />Application Services for AJAX applications<br />Website administration<br />Wide range choices for caching<br />Levels: Application, Session, Cache, Cookie, Page, Portion of Page<br />Handling errors<br />
  12. 12. WebForms Feature Highlights (contd.)<br />ViewState<br />Technique to persist changes to state of a WebForm across postbacks<br />Stores in a hidden input field __VIEWSTATE<br />Encrypted<br />Increase length of the page, hence slows down<br />You can turn on/off<br />
  13. 13. Cozying up with ASP.NET Development<br />demo <br />Building a complete data driven site<br />
  14. 14. Groundbreaking innovation<br />LINQ<br />Language INtegrated Query<br />
  15. 15. Language INtegrated Query - LINQ<br />Pronouced as “Link”<br />A language construct<br />Strongly typed query against objects<br />Full intellisense support <br />Can be used with any collection of objects that implements IEnumerable&lt;T&gt;<br />Highly extensible<br />LINQ to XML<br />LINQ to SQL<br />LINQ to Flickr! etc.<br />
  16. 16. LINQ Benefits<br />Simply put - avoiding having to learn and master many different domain languages, development or debugging environments in order to retrieve and manipulate data from different sources<br />One language to query all.<br />Deferred Execution<br />Process queries only when foreach/ToList() is being called.<br />Parallel Extensions help LINQ queries run in multiple processor cores in ASP.NET 4<br />
  17. 17. Querying objects<br />demo <br />
  18. 18. Obtaining data source<br />Query Expression Syntax:<br />varallProducts = from p in products select p;<br />Extension Method:<br />No representation. productsis the collection of objects<br />
  19. 19. Filtering<br />Query Expression Syntax:<br />varlowOnProducts = from p in products <br /> where p.UnitsInStock &lt; 10 select p;<br />Extension Method:<br />products.Where(p =&gt; p.UnitsInStock &lt; 10);<br />
  20. 20. Ordering<br />Query Expression Syntax:<br />varlowOnProducts = from p in products <br /> where p.UnitsInStock &lt; 10 <br />orderbyp.Name ascending <br /> select p;<br />Extension Method:<br />products.Where(p =&gt; p.UnitsInStock &lt; 10)<br /> .OrderBy(p =&gt; p.Name);<br />
  21. 21. Ordering (contd.)<br />Other helpful Extension Methods:<br />OrderBy<br />OrderByDescending<br />ThenBy<br />ThenByDescending  <br />
  22. 22. Grouping<br />string[] partNumbers = new string[] { &quot;SCW10&quot;, &quot;SCW1&quot;, &quot;SCW2&quot;, &quot;SCW11&quot;, &quot;NUT10&quot;, &quot;NUT1&quot;, &quot;NUT2&quot;};<br />Query Expression Syntax: <br />var query = from pN in partNumbers<br /> group pN by pN.Substring(0,3);<br /> Extension Method:<br />var query = partNumbers<br /> .GroupBy(pN =&gt; pN.Substring(0,3));<br />foreach (var group in q) {<br />Console.WriteLine(&quot;Group key: {0}&quot;, group.Key);<br />foreach (var part in group) {<br />Console.WriteLine(&quot; - {0}&quot;, part);<br /> }<br />}<br />varlowOnProducts = from p in products <br /> where p.UnitsInStock &lt; 10 <br />orderbyp.Name ascending <br /> select p;<br />products.Where(p =&gt; p.UnitsInStock &lt; 10)<br /> .OrderBy(p =&gt; p.Name);<br />
  23. 23. Grouping (contd.)<br />Iterating through grouped data:<br />foreach (var group in query) {<br />Console.WriteLine(&quot;Group key: {0}&quot;, group.Key);<br />foreach (var part in group) {<br />Console.WriteLine(&quot; - {0}&quot;, part);<br /> }<br />}<br />
  24. 24. Standard Query Operators<br />
  25. 25. Standard Query Operators (contd.)<br />
  26. 26. Querying and modifying data<br />demo <br />LINQ DataContext<br />
  27. 27. LINQ Query Provider<br />Roll your own provider:<br />YouTubeContextcontext = new YouTubeContext();<br />var query = (from v in context.Videos<br /> where v.Location == &quot; Moghbazar &quot; && v.SearchText == “Rail Crash&quot;<br />select v).IfNotViewedBy(“TanzimSaqib”);<br />Building LINQ Provider series:<br />
  28. 28. Life easier with<br />Dynamic Data<br />
  29. 29. Dynamic Data Overview<br />Build powerful data driven sites in a minute!<br />Automatic creation of <br />WebForms<br />Controls and data binding<br />Validation logic in place<br />Metadata inferred from schema<br />Easy and highly customizable<br />Time saver and reusable<br />
  30. 30. Building a website in less than a minute!<br />demo <br />
  31. 31. Field Templates<br />Fields are User Controls<br />Dynamically chosen by datatype<br />Responsible for<br />Data binding<br />Validation and<br />Rendering<br />Reusable<br />
  32. 32. Customizing Fields<br />demo <br />
  33. 33. Customizing Pages<br />Page Templates<br />Changes affect all pages<br />Custom pages for individual tables<br />Custom columns and rendering<br />
  34. 34. Customizing Pages<br />demo <br />
  35. 35. Routing<br />Standard URL:<br /><br />Extensionless clean URL:<br /><br />No necessity to move files around<br />Routing engine is being used by<br />Dynamic Data<br />ASP.NET MVC<br />Attend the next session for deep dive into Routing and ASP.NET MVC<br />
  36. 36. Routing<br />demo <br />
  37. 37. Future is now<br />ASP.NET 4<br />Beta 1<br />
  38. 38. Futures - ASP.NET 4<br />Support for meta tags<br />Page.Keywords, Page.Description<br />Enabling ViewState for individual controls<br />ViewStateMode property of the control<br />Reading route values at Page level:<br />Page.RouteData.Values[“param_name_here&quot;]<br />Reading route values from markup:<br />&lt;%$ RouteValue:param_name_here %&gt;<br />More precise and predictable ClientIDs<br />
  39. 39. Futures - ASP.NET 4 (contd.)<br />QueryExtender<br />New server control<br />Works with LinqDataSource and EntityDataSource<br />More control over what is coming from Database<br />Controls for nested use with QueryExtender<br />SearchExpression<br />RangeExpression<br />PropertyExpression<br />CustomExpression<br />
  40. 40. Futures - ASP.NET 4 (contd.)<br />Web.config transformation:<br />Development settings: web.debug.config<br />Production settings: web.release.config<br />Dynamic Data<br />New field template for URL, Email addresses<br />Client Template and Live data binding<br />Enables binding data source to HTML elements<br />Implemented with Observer pattern<br />Data changes from/to UI to/from Database notified<br />
  41. 41. Futures - ASP.NET 4 (contd.)<br />Example<br />&lt;script type=&quot;text/javascript&quot;&gt;    <br />vardataContext = new Sys.Data.DataContext();<br />dataContext.set_serviceUri(&quot;emplyeeService.svc&quot;);<br />dataContext.initialize();   <br />&lt;/script&gt;  <br />&lt;ul sys:attach=&quot;dataview&quot; class=&quot;sys-template &quot;  <br />    dataview:autofetch=&quot;true&quot;  <br />    dataview:dataprovider=&quot;{{ dataContext }}&quot;  <br />    dataview:fetchoperation=&quot;GetEmployeeList&quot;&gt;  <br />    &lt;li&gt;    <br />        &lt;h3&gt;{binding Name}&lt;/h3&gt;  <br />        &lt;div&gt;{binding Address}&lt;/div&gt;  <br />    &lt;/li&gt;  <br />&lt;/ul&gt;  <br />
  42. 42. Futures - ASP.NET 4 (contd.)<br />Many more. For more information:<br />
  43. 43. Links and downloads:<br />Q & A<br />
  44. 44. Thank you<br />