Rapidly Building Data Driven Web Pages with Dynamic ADO.NET


Published on

Come learn about how new technologies from Microsoft bring together the concepts of dynamic languages and ADO.NET and allow you to quickly develop data driven Web pages using ASP.NET dynamic data controls, scalable to even the most complex databases.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

  1. 1. Shyam Pather Sam Druker Development Lead Product Unit Manager Data Programmability Data Progammability
  2. 2. Quick Clean Rapid Easy Instant Gratification Iterative Intuitive
  3. 3. Hierarchical data binding • Insert/Update/Delete • No generated code • No configuration • Jasper National Park
  4. 4. Shyam Pather Development Lead Crowfoot Glacier Data Programmability Icefields Parkway, near Jasper National Park
  5. 5. Intro to Project Codename quot;Jasperquot; – Dynamic ADO.NET Jasper Technical Walk-through ASP.NET Development with the Jasper AutoDataSource Extending Jasper Data Classes – Business Logic Beyond Demo-ware: Jasper and Real-World Databases
  6. 6. Project goal Enable rapid, iterative development of data-serving applications Target scenarios Forms over data Interactively exploring data with code Jasper, AB Key features Data classes inferred at runtime Automatic data binding
  7. 7. YES NO Point at a database and begin coding Excessive configuration One simple way to do Heavyweight tools things Generated source files Works with real-world databases
  8. 8. CTP available today http://msdn2.microsoft.com/data/bb419139.aspx ADO.NET Team We're here to get your feedback Jasper Jasper is an incubation project Design ASP.NET VB Team Team Team CLR Team
  9. 9. Jasper provides a programming interface to your data API surface tailored for dynamic language development Data Access and Data Binding Without generated source code or complex configuration Query Object API Jasper Update UI Binding
  10. 10. O/R Framework + API ASP.NET WinForms/WPF AutoDataSource AutoBinder Data classes inferred at runtime Automatic UI Binding Jasper API ASP.NET AutoDataSource Runtime Data Class AutoBinder for WinForms/WPF Generator Built on ADO.NET Entity Framework ADO.NET Entity Framework Rich Mapping Engine Entity SQL Query Pipeline .NET Data Providers
  11. 11. ADO.NET Capabilities EDM Concepts • Provides a higher level • .NET Object API for manipulating data abstraction for data in the store in a store • Mapping engine constructs Entities and Relationships from tables and keys • Successor to the core relational data model • eSQL and LINQ Query Pipeline • Providers to various database stores • Adds formal relationships, • Management of metadata for flexible inheritance, and composition deployment
  12. 12. DynamicContext Class Configured with a connection string Serves as an overall context for the database Exposes properties corresponding to the database tables Does change tracking and identity resolution Dim connectionString As String = quot;...quot; Dim context context = DynamicContext.CreateDynamicContext(connectionString) ...context.Stories ... context.Submitters etc...
  13. 13. Query class Provides Entity SQL and LINQ query capabilities 'LINQ Query storiesQuery = From t In CType(My.DynamicContext.Tags, IQuery) _ Where t.TagName = tag _ Select t.Story _ Distinct 'Direct Entity SQL Query Dim results results = My.DynamicContext.ExecuteDirectQuery(quot;SELECT VALUE s FROM DataAccessCityModel.Stories As squot;) 'Entity SQL Query with query-builder methods storiesQuery = My.DynamicContext.Stories.Where(quot;it.Topic.TopicId = @TopicId quot;, _ New ObjectParameter() {New ObjectParameter(quot;TopicIdquot;, topicId)})
  14. 14. Data Classes Represent the entities in the database Reflect database schema by default DynamicContext creates data classes at runtime Usable at compile-time via late binding Builds an Entity Data Model with relationships from Database Schema Infers classes from Entity Data Model Bottle Winery Supplier Database Schema Data Classes Entity Data Model
  15. 15. AutoDataSource component A data source control that uses Jasper for data access Automatically configures data binding of web controls Naming conventions determine bindings Can bind contols to Entity Sets Relationship navigation properties Arbirtrary queries Supports read and write (insert, update, delete) operations
  16. 16. Creating the AutoDataSource: Markup <jasper:AutoDataSource ID=quot;AutoDataSource1quot; runat=quot;serverquot; /> Creating the DynamicContext: Code-behind Dim connectionString As String = quot;...quot; Dim context context = DynamicContext.CreateDynamicContext(connectionString) Creating the data-bound controls: Markup <asp:ListBox ID=quot;CategoryNamequot; runat=quot;server” /> … <asp:DetailsView ID=quot;Categories_Productsquot; runat=quot;serverquot; … />
  17. 17. Shyam Pather Development Lead Data Programmability Horned Sheep at Miette Hot Springs (near Jasper, AB)
  18. 18. Implement GetProperty and SetProperty methods Naming convention: data class generator makes property getters/setters call these methods Access to all data class properties Public Class Story Public Function SetDescription(ByVal desc As String) As String 'Truncate the description if too long If desc.Length > 200 Then Dim i = desc.LastIndexOf(quot; quot;) Return desc.Substring(0, i + 1) + quot;...quot; End If Return desc End Function End Class
  19. 19. How do we expose type information at design time? Requires extension of current IntelliSense system. We are working with language teams on this!
  20. 20. Shyam Pather Development Lead Data Programmability Athabasca Falls (Jasper National Park)
  21. 21. Dynamic Data Classes Custom Data Default Data Model Model Define Custom No Customize Data Model and Customization Naming Service Mapping Simple Database Simple Database Complex Database with Unconventional Names
  22. 22. Supports custom naming conventions and pluralization rules Dim ns As NameService = New NameService() ns.BaseNameService = NameService.Default ns.ClassNameMap.AddNameMapping(quot;P2NWEMPquot;, quot;Employeesquot;) ns.ClassNameMap.AddPrefixMapping(quot;avw_quot;) ns.ClassNameMap.AddNameRegexMapping(quot;Empzquot;, quot;Employeequot;) Dim context = DynamicContext.CreateDynamicContext(connectionString, ns)
  23. 23. Rich ADO.NET Entity Framework Mapping Engine supports: Renaming De-normalization Horizontal and vertical partitioning Stored-procedure access Jasper API can be used over any mappable Entity Data Model
  24. 24. Pyramid Lake (Jasper National Park)
  25. 25. We are planning a second CTP before the end of '07 Try out Jasper in the Mix Sandbox Download Jasper and try it with your own applications http://msdn2.microsoft.com/data/bb419139.aspx Please give us feedback! Jasper Forum: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1556&SiteID=1 Andy Conrad’s blog: http://blogs.msdn.com/aconrad/ Shyam Pather’s blog: http://pather.net/shyam/ Carl Perry’s blog: http://blogs.msdn.com/cperry/ ADO.NET Team blog: http://blogs.msdn.com/adonet/
  26. 26. © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.