Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

47
Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland

Transcript of Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Page 1: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Preview of ASP.NET 2.0 in Delphi Course #3182

Jim TierneyPrincipal Engineer - Borland

Page 2: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Feature Overview

Agenda Overview of many ASP.NET 2.0 features Preliminary description of Highlander support for ASP.NET 2.0

Page 3: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features(Covered in this presentation)

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

Project migration

Page 4: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

New for Highlander

Webform designer support for Master Pages, Content Pages, Themes and Skins

BDP DataSource

ECO DataSource

Delphi language support for partial classes

Delphi Code DOM Provider

Directory-based projects

Use ASP.NET 2.0 build services

BDP support for application services

Page 5: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content PagesThemes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

Project migration

Page 6: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Master Pages and Content Pages

Master Pages allow you to apply the same layout to multiple content pages. Typically a Master page has some markup that will be reused across multiple content pages (such as a heading) and one or more asp:contentplaceholder controls that indicate where content pages can insert additional markup.

Content pages reference a single master page. A content page contains one or more asp:content controls. The markup within an asp:content control is merged with the master page at runtime.

Page 7: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Master Page

Sample file: MasterPage.Master

<%@ Master Language="C#" CodeFile="MasterPage.master.cs" Inherits="MasterPage_master" %>

<html><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> Sample heading <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> Sample footing</div> </form></body></html>

New

Directive

New directive

New file extension

New master page control

Page 8: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Content Page

Sample File: Default2.aspx<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"

CodeFile="Default2.aspx.cs" Inherits="Default2_aspx" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

Sample content<br/>

<asp:Button ID="Button1" runat="server" Text="Button" />

</asp:Content>

New attribute

New content page control Reference to control in master

Merge with master

Page 9: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Master and Content Page

Demo

Page 10: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Master Pages in Highlander

New Gallery items

Webform designer support for master and content pages See merged content Read only areas on content pages

Page 11: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and SkinsData Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

Project migration

Page 12: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Themes

Customize the look of a web application A collection of .skin and or .css files in a folder

WebSite1 app_Themes

Professional1 Pro1.skin Pro2.skin

BasicBlue Blue.css BluePages.skin BlueControls.skin

Project directory

Special directory for themes

Directory name is the theme name

The.skin files and stylesheets (.css) make up

the theme (image files are also common)

Page 13: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

.skin files

Contains one or more Default skins

Applies to all controls of that type <asp:label font-name="tahoma" font-bold="true" forecolor=“blue"

backcolor=“white" /> Named skins

Applies to controls that reference the id <asp:label skinid="labelred" font-name="tahoma" font-bold="true"

forecolor=“red" backcolor=“white" />

Page 14: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Using Themes and Skins

<%@ page theme=“BasicBlue" %>

<html> <body> <form runat="server">

<asp:label runat="server“ id=“label1"> test default skin

</asp:label><br>

<asp:label runat="server“ id=“label2“ skinid=“labelred”> test named skin

</asp:label>

</form> </body> </html>

Reference to named skin

Reference to theme

Will use default asp:label skin in the BasicBlue theme

Page 15: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander Support for Themes and Skins

New Gallery Items Webform designer renders using themes

Page 16: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data BindingCode Separation

Special Directories

Build Process

Precompilation

Application Services

Page 17: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 DataSource Controls

Represent different backend sources Asp:SqlDataSource Asp:XMLDataSource Asp:ObjectDataSource Asp:AccessDataSource

Replacement for non-visual data components used in ASP.NET 1.1 DataSet, DataTable, SqlConnection, SqlDataAdapter,

SqlCommand

Built in data manipulation Sorting, paging, filtering, updating, deleting, inserting

Page 18: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Data binding

Design time support for standard Datasource controls Design time support is part of the framework (rather than built into

VS.NET)! Query builder Connection editor

New Borland Datasource controls EcoDataSource

DataSource component to bind to Eco objects BDPDataSource

DataSource component to connect to BDP databases

Page 19: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code SeparationSpecial Directories

Build Process

Precompilation

Application Services

Page 20: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Code Separation

ASP.NET 1.1 Codebehind

Codebehind is supported by ASP.NET 2.0 and ASP.NET 1.1 (but not by VS.NET 2005)

ASP.NET 2.0 Codebeside

Codebeside is new to ASP.NET 2.0 and not compatible with ASP.NET 1.1

Page 21: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Code Separation

Codebehind and Codebeside Similarities Page consists of a markup file (e.g.; .aspx) and code file

(e.g.; .cs or .pas) Markup file contains html and asp control markup Code file contains event handlers for asp controls (e.g.;

Button1Click, PageLoad) ASP.NET runtime compiles markup files

Generates a page class derived from the page class in the code file

Compiles the generated code into temporary assemblies

Page 22: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Code Separation

Differences Document Directives

Codebehind <%@ Page Language=“c#” Codebehind=“Default.aspx.cs” Inherits=“WebApplication1.DefaultForm” %>

Codebeside <%@ Page Language=“c#” CodeFile=“Default.aspx.cs” Inherits=“DefaultForm” %>

Compilation of code files (e.g.; .cs) Codebehind

IDE compiles all code files into a single assembly (i.e.; the codebehind assembly) Codebeside

ASP.NET runtime compiles code files at the same time that markup files are compiled Code file structure

Codebehind Includes declarations for asp controls in the code file (e.g.; system.web.ui.button button1;) Declares event handlers as private members InitializeComponent function assigns event handlers to asp control event properties

Codebeside Declares a partial page class No need for asp control declarations in code file

The declarations will be generated into a class fragment when the ASP.NET runtime compiles the markup Event handlers are declared as protected Event handlers associated with event properties in the markup file

Page 23: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Code Separation

Demo

Page 24: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Code Separation

Support codebeside for C#

Support codebeside for Delphi New Delphi language syntax

Class fragment

Delphi Code DOM provider is required because markup and .pas file are compiled into the same assembly

Highlander may support codebehind projects

Page 25: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special DirectoriesBuild Process

Precompilation

Application Services

Page 26: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Special Directories

Folders in the project directory that have special meaning to the ASP.NET runtime

/Bin was the only ASP.NET 1.1 “special directory”

Page 27: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Special Directories

(Partial list)

Bin Contains assemblies required to build the app

app_code Contains .cs and .pas files that are not associated with a markup file

app_webreferences .wsdl and .disco files created by Add Web Reference… command No code files (code is automatically generated as part of the asp.net runtime build process)

app_data Application data files such as

.xml data files mdf database files

app_themes Theme directories .skin files

Page 28: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Special Directories

Support directory-based ASP.NET projects No .bdsproj or .dpr file All files in the project directory are part of the project File/Open/Web Site… prompts for a directory rather than project file Assembly references are declared in web.config rather than a project

file Projects created by VS.NET open in Highlander without changes Project created by Highlander open in VS.NET without changes

Page 29: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content PagesThemes and SkinsData BindingCode SeparationSpecial Directories

Build ProcessPrecompilationApplication ServicesLocalization ResourcesControl designer featuresMobile Device SupportProject migration

Page 30: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Build Process

ASP.NET 1.1 Code must be generated by a tool

Web service proxies Typed data sets

Assemblies must be built by a tool Code behind assembly Resource assemblies

ASP.NET runtime processes markup files only Generates code (e.g.; c#) Compiles generated code, referencing assemblies in /bin

ASP.NET 2.0 ASP.NET runtime processes markup files similar to 1.1 In addition, scans the files in the project directory, automatically performing code

generation and compilation for many file types Code files (.cs using codedom providers registered in machine.config and web.config) Localization resources (.resx using resgen.exe) Web Services (.wsdl, .discomap using wsdl.exe) Typed data sets (.xsd using xsd.exe)

Page 31: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Build Process

Demo

Page 32: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Codedom Providers

Codedom providers are similar in 1.1 and 2.0 Two responsibilities

Convert a codedom into source code ASP.NET runtime generates a codedom from markup Other tools generate codedoms

Wsdl import tool (wsdl.exe) Xsd import tool (xsd.exe) to generate typed data sets

Compile code into an assemblyASP.NET 2.0 runtime relies more heavily on codedom providers

Compile codebeside associated with web forms, user controls and web services

Compile source files in /code directory Generate and compile code

Wsdl import Xsd import Strongly typed resources (See Localization Resources topic) User profile classes (See Application Services topic)

Page 33: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Build Process

Use ASP.NET build services to verify syntax of project files Verifies all files that will be built by the ASP.NET runtime, not

just code files Finds markup file (.aspx) syntax errors Finds web.config errors

Page 34: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

PrecompilationApplication Services

Project migration

Page 35: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Precompilation

Batch compiles all pages in the site Improves performance the first time the website is accessed Two types of precompilation

In-place precompilation Equivalent to browsing to all the pages in the app Invoked with special URL http::/localhost/WebSite1/Precompile.axd

Precompilation for Deployment Removes source code to protect IP

Can choose to remove markup or leave in place so that it can be customized later

Invoked using aspnet_compiler.exeaspnet_compiler -v /<websitename> -p <source> <destination>

Page 36: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Precompilation

Precompilation commands within the IDE Deployment manager support for copying precompiled

projects over FTP

Page 37: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application ServicesProject migration

Page 38: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Application Services

“Provider Model” pattern

Types of providers

Provider Implementations

Web site configuration tool

Page 39: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Provider Model Pattern

Multiple provider types Each type has a well defined interface

Allows for different implementation of a provider type Use SQLServer User defined class

Web application code is independent of provider implementation Web.config defines implementation of provider

Assembly name Class name

ASP.NET infrastructure responsible for instantiating provider defined in web.config

Page 40: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Types of Providers

Membership Provider User names, passwords, password hints

Profile Provider User profile (e.g.; shopping cart)

Personalization Provider User personalization (e.g.; preferred background

color)Role Provider

List of names Associate roles with users to deny users access to

parts of web site

Page 41: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Provider Implementations

MS implementations declared in machine.config<roleManager>

<providers><add name="AspNetSqlRoleProvider“

connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

<add name="AspNetWindowsTokenRoleProvider“ applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web,

Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /><add name="AspNetAccessProvider"

connectionStringName="AccessFileName" applicationName="/" type="System.Web.Security.AccessRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

</providers></roleManager>

Web Site Configuration Tool Use to select an implementation from machine.config or web.config

Updates web.config<roleManager enabled="True" defaultProvider="AspNetSqlRoleProvider" />

SQLServer setup SQLServer setup wizard

Aspnet_regsql.exe Creates or configures a SQLServer database to store information for ASP.NET application services

Aspnetdb is default database names Tables include asp_profile, asp_user, asp_roles

Page 42: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Web Site Configuration Tool

Modifies web.config Select provider implementations

Invokes providers

Role ProviderEdit roles

Membership providerEdit users

Page 43: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Highlander and Application Services

Launch Web Site Configuration Tool from IDE

BDP Provider implementations Tool to create database and tables BDP provider assemblies Delphi Installer declares BDP providers in machine.config

Allows web site administration tool to select BDP providers Deployment manager deploys BDP provider assemblies

Page 44: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

Project migration

Page 45: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Project Migration

Opening a Delphi 2005 project in Highlander Conversion

Move files to special directories Convert codebehind to codebeside

Change to partial classes Remove declarations of controls for code file

Declare event handlers as protected

Backward compatibility Support codebehind Designer has component tray

Page 46: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Summary

New for Highlander Directory-based projects Use ASP.NET 2.0 build services Delphi language support for partial classes Delphi Code DOM Provider Borland BDP Providers for application services BDP DataSource ECO DataSource Webform designer support for Master Pages, Content Pages,

Themes and Skins

Page 47: Preview of ASP.NET 2.0 in Delphi Course #3182 Jim Tierney Principal Engineer - Borland.

Thank You

Questions?

Steve Trefethen’s blog

http://blogs.borland.com/stevet/