Preview of ASP.NET 2.0 in Delphi

acceptableseashoreΑσφάλεια

5 Νοε 2013 (πριν από 3 χρόνια και 8 μήνες)

73 εμφανίσεις

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

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

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

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

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.

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

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

Master and Content Page

Demo

Master Pages in Highlander

New Gallery items

Webform designer support for master and content pages


See merged content


Read only areas on content pages

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

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)

.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" />

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

Highlander Support for Themes and Skins


New Gallery Items


Webform designer renders using themes

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

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

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


ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services


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


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

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

Code Separation

Demo

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

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

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”

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

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

ASP.NET 2.0 Features

Master Pages and Content Pages

Themes and Skins

Data Binding

Code Separation

Special Directories

Build Process

Precompilation

Application Services

Localization Resources

Control designer features

Mobile Device Support

Project migration

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)

Build Process

Demo

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 assembly

ASP.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)

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

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

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


aspnet_compiler
-
v /<websitename>
-
p <source> <destination>

Highlander and Precompilation


Precompilation commands within the IDE


Deployment manager support for copying precompiled
projects over FTP

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

Application Services

“Provider Model” pattern

Types of providers

Provider Implementations

Web site configuration tool

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


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

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

Web Site Configuration Tool

Modifies web.config


Select provider implementations

Invokes providers


Role Provider


Edit roles


Membership provider


Edit users

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

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

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


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

Thank You

Questions?


Steve Trefethen’s blog

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