29

Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Embed Size (px)

DESCRIPTION

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.

Citation preview

Page 1: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET
Page 2: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

DEV 18 - Rapidly Building Data-Driven Web Pages with Dynamic ADO.NET

Sam DrukerProduct Unit ManagerData Progammability

Shyam PatherDevelopment LeadData Programmability

Page 3: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Quick Rapid Clean Instant Gratification Easy

Iterative Intuitive

Page 4: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

How fast can I build a data-driven web app?

• Hierarchical data binding• Insert/Update/Delete• No generated code• No configuration

challenge

Jasper National Park

Page 5: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Dynamic ADO.NET in Action

Shyam PatherDevelopment LeadData Programmability

demo

Crowfoot GlacierIcefields Parkway, near Jasper

National Park

Page 6: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Agenda

Intro to Project Codename "Jasper" – Dynamic ADO.NETJasper Technical Walk-throughASP.NET Development with the Jasper AutoDataSourceExtending Jasper Data Classes – Business LogicBeyond Demo-ware: Jasper and Real-World Databases

Page 7: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Project Codename "Jasper"

Project goalEnable rapid, iterative development of data-serving applications

Target scenariosForms over dataInteractively exploring data with code

Key featuresData classes inferred at runtimeAutomatic data binding

Jasper, AB

Page 8: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper Development Experience

Point at a database and begin coding

One simple way to do things

Works with real-world databases

Excessive configuration

Heavyweight tools

Generated source files

YES NO

Page 9: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper Project Status

CTP available todayhttp://msdn2.microsoft.com/data/bb419139.aspx

We're here to get your feedbackJasper is an incubation project Jasper

Design Team

ADO.NET Team

ASP.NET Team

CLR Team

VB Team

Page 10: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper Technical Overview

Jasper provides a programming interface to your data

API surface tailored for dynamic language development

Data Access and Data BindingWithout generated source code or complex configuration

JasperQuery

Update

Object API

UI Binding

Page 11: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper Components

O/R Framework + APIData classes inferred at runtime

Automatic UI BindingASP.NET AutoDataSourceAutoBinder for WinForms/WPF

Built on ADO.NET Entity Framework

Rich Mapping EngineEntity SQL Query Pipeline.NET Data Providers

Jasper API

Runtime Data Class Generator

ADO.NET Entity Framework

ASP.NET AutoDataSour

ce

WinForms/WPFAutoBinde

r

Page 12: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

ADO.NET Entity FrameworkADO.NET Capabilities

• .NET Object API for manipulating data in a store

• Mapping engine constructs Entities and Relationships from tables and keys

• eSQL and LINQ Query Pipeline

• Providers to various database stores

• Management of metadata for flexible deployment

EDM Concepts

• Provides a higher level abstraction for data in the store

• Successor to the core relational data model

• Adds formal relationships, inheritance, and composition

Page 13: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper API – DynamicContext Class

DynamicContext ClassConfigured with a connection stringServes as an overall context for the databaseExposes properties corresponding to the database tablesDoes change tracking and identity resolution

Dim connectionString As String = "..." Dim contextcontext = DynamicContext.CreateDynamicContext(connectionString)

...context.Stories ... context.Submitters etc...

Page 14: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper API – Querying

Query classProvides 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 resultsresults = My.DynamicContext.ExecuteDirectQuery("SELECT VALUE s FROM DataAccessCityModel.Stories As s")'Entity SQL Query with query-builder methods

storiesQuery = My.DynamicContext.Stories.Where("it.Topic.TopicId = @TopicId ", _New ObjectParameter() {New ObjectParameter("TopicId", topicId)})

Page 15: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper API – Data ClassesData Classes

Represent the entities in the database

Reflect database schema by default

DynamicContext creates data classes at runtimeUsable at compile-time via late binding

Builds an Entity Data Model with relationships from Database Schema

Infers classes from Entity Data Model

Data Classes

Bottle Winery

Supplier

Database Schema Entity Data Model

Page 16: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Using Jasper with ASP.NET

AutoDataSource componentA data source control that uses Jasper for data accessAutomatically configures data binding of web controls

Naming conventions determine bindings

Can bind contols toEntity SetsRelationship navigation propertiesArbirtrary queries

Supports read and write (insert, update, delete) operations

Page 17: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Jasper ASP.NET Code Snippets

<jasper:AutoDataSource ID="AutoDataSource1" runat="server" />

<asp:ListBox ID="CategoryName" runat="server” />…<asp:DetailsView ID="Categories_Products" runat="server" … />

Dim connectionString As String = "..." Dim contextcontext = DynamicContext.CreateDynamicContext(connectionString)

Creating the AutoDataSource: Markup

Creating the DynamicContext: Code-behind

Creating the data-bound controls: Markup

Page 18: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Implementing Business Logic on Jasper Data ClassesShyam PatherDevelopment LeadData Programmability

demo

Horned Sheep at Miette Hot Springs (near Jasper,

AB)

Page 19: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Implementing Business LogicImplement GetProperty and SetProperty methods

Naming convention: data class generator makes property getters/setters call these methods

Access to all data class propertiesPublic 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(" ") Return desc.Substring(0, i + 1) + "..." End If Return desc  End FunctionEnd Class

Page 20: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

IntelliSense Support for Jasper

How do we expose type information at design time?Requires extension of current IntelliSense system.We are working with language teams on this!

Page 21: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Beyond Demo-ware: Jasper and Real-World DatabasesShyam PatherDevelopment LeadData Programmability

demo

Athabasca Falls (Jasper National Park)

Page 22: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Customization with Jasper

Simple Database Simple Database with Unconventional Names

Complex Database

No Customization

CustomizeNaming Service

Define Custom Data Model and

Mapping

Default Data ModelCustom Data

Model

Dynamic Data Classes

Page 23: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Naming Service Customization

Supports custom naming conventions and pluralization rules

Dim ns As NameService = New NameService()ns.BaseNameService = NameService.Default ns.ClassNameMap.AddNameMapping("P2NWEMP", "Employees")ns.ClassNameMap.AddPrefixMapping("avw_")ns.ClassNameMap.AddNameRegexMapping("Emp\\z", "Employee") Dim context = DynamicContext.CreateDynamicContext(connectionString, ns)

Page 24: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Using a Custom EDM and Mapping

Rich ADO.NET Entity Framework Mapping Engine supports:

RenamingDe-normalizationHorizontal and vertical partitioningStored-procedure access

Jasper API can be used over any mappable Entity Data Model

Page 25: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Entity Model Designer Tools

video

Pyramid Lake (Jasper National Park)

Page 26: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET
Page 27: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

What Next?

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 applicationshttp://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/

Page 28: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

Please fill out your eval

evaluation

Page 29: Rapidly Building Data Driven Web Pages with Dynamic ADO.NET

© 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.