Agenda
從 Win32 的 Object Pascal 程式語 言到 .NET 的 Delphi 程式語言
一般 Delphi 程式如何移植到 .NET DLL/COM/COM+/ActiveX 元件和 .NE
T 程式 Delphi 元件和 .NET 元件 VCL Framework 和 VCL .NET Delphi 資料庫應用程式如何移植
成 .NET 資料庫應用程式 Q&A
Borland Delphi
Large and loyal independent developer community- Estimated 1 million developers world wide- 50% of the BDN community (1.6m registrations)- 580 registered component developers
Strong solution for SME, Departmental, and ISV Applications
ALM/.NETALM/.NET
Web Services
Multi-tier
Delphi Technology Innovation
Windows/desktop
Client/Server
Database
Multi-tier
Intranet/Internet
Web Services
ALM / .NET
Future Technology
Delphi Technology Foundation
Future
Delphi Compiler.NET
ApplicationLifecycle
Management
Delphi IDE
Delphi CompilerWin32
VCL.NET VCL Winforms
.NET Win32
WebForms
DesignDriven
Development
Language
API
Platform
Strategic
What the Analysts Say
“Delphi developers should pay careful attention to the delivery of Borland’s new .NET IDE before any transition to Visual
Studio .NET … it has the potential to better meet the needs of developers
leveraging .NET in a multi-vendor, best-of-breed environment.”
—Mark Driver, Research Analyst, Gartner Group
Project Octane for Win32 and .NET
Accelerate the Delphi Application Lifecycle for Win32 and .NET
Address the needs of Delphi developers on Windows and those moving to .NET
Increase productivity with Design Driven development
Interoperability with Mixed environments
Requirements
Deploy
Develop
Test
ChangeManagement
Design
Microsoft Platform Evolution
Win16 Win32 .NET
Delphi 1 Delphi 2 Octane
Delphi supports the Windows .NET evolution- Managed code, Optimized for Windows- The “new API” for Windows, the Windows Platform Standard- .NET adoption, Not “if” but “when”
x86 x86 Managed Code
Borland Commitment to Windows and .NET
02/02 Borland announces support for Microsoft .NET
08/02Delphi 7 Studio and the Borland Preview for Microsoft .NET shipped
10/02 Borland joins .NET Advisory Council
12/02 .NET SDK redistribution agreement signed
02/03Borland announces Optimizeit Profiler for the Microsoft .NET Framework
04/03Borland Platinum sponsor at Microsoft Windows Server 2003 launch event
04/03 Borland announces ALM for .NET strategy
05/03Borland announces C#Builder for the Microsoft .NET Framework and Borland Janeva
.NET Support
Reuse Delphi language skills with the Microsoft .NET Framework- DCCIL compiler is first class .NET citizen generating 100% .NET
code- Build new .NET applications using the Delphi language
Migrate existing Delphi applications to .NET- VCL.NET is 100% .NET compliant component library with a high
degree of VCL compatibility- Reuse existing code
Single environment for Delphi and C# development- Octane IDE will interoperate with C#Builder IDE (or vice-versa)- Enables Delphi developers to add C# to their projects and skills
Application Lifecycle Management Solution for Octane
MicrosoftWindows .NET
Server
Design Project Octane
Optimizeit Profiler™
For .NET
CaliberRM™
StarTeam®
Conveniently profile any Octane .NET assembly or executable in your project from within Octane
Easily check Octane source files in and out of StarTeam repository through Octane’s built-in LiveTeam features
Win32 and .NET modeling tool integration. Integrated UML Designer
Monitor Octane project requirements progress via the CaliberRM status pane within Octane
從 Win32 的 Object Pascal 程式語 言到 .NET 的 Delphi 程式語言
Object Pascal幾乎完整的移植到 .NET中 , 除了不符合 .NET CLR/CLS規範以及存取硬體的機制
Object Pascal強化了語言機制 , 支持 .NET CLR/CLS功能 , 因此改為 Delphi語言
DFM檔案內之 Persistent資訊將以 Delphi原始碼的形式融入 .PAS檔案中
Data Type Mapping
Extended System.Double是一個 8-byte floating-point type
Char變成 2個位元 String成為WideString
New & Improved
Unit Namespaces Qualified Identifiers Nested Types Custom Attributes Class (static) data Class properties Class static methods Records w/ Inheritance Records w/ methods Sealed classes Final methods
Multicast Events Include/Exclude events Array prop overloads “Boxing” into objects
Unit Namespaces
Access units with fully qualified idents- Uses Borland.VCL.Forms;
Delphi unit defines its own namespace- Dotted names in unit identifiers and file names
Project namespace search path- Search for unqualified unit names on namespace path- Uses Forms;- In VCL project, Forms -> Borland.VCL.Forms- In CLX project, Forms-> Borland.CLX.Forms
Project default namespace
Project Namespaces
Eliminate uses clause IFDEFs Project namespace search path
- Search for unqualified unit names on namespace path- Uses Forms;- In VCL project, Forms -> Borland.VCL.Forms- In CLX project, Forms-> Borland.CLX.Forms
Project default namespace- Unit MyControl;- VCL project: compiles to Borland.VCL.MyControl.DCU- CLX project: compiles to Borland.CLX.MyControl.DCU
Using Attributes
type[ FooAttribute(‘Hello’, 23) ]TMyClass = class
[ SpecialDataAttribute ]Fdata: Integer;[ WebMethod,
DebuggerStepThrough ]function SampleCount: Byte;
end;
開發流程
aDelphi專案 (*.dpr)
Delphi程式單元 (*.dfm)
DFM2PAS
Delphi.NET原始程式 (*.pas)
Delphi.NET專案 (*.dpr)Delphi.NET Compiler
dccil
.NET應用程式
使用 DFM2PAS/Dccil
Dfm2pas PWin32Prg.dpr PNetPrg.dpr 修改 PWin32Prg.dpr dfm2pas fmMain.pas fmNetMain.pas
Dccil –v PNetPrg.dpr
A Object Pascal/Delphi Language Sample Program
TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } class var iX : Integer; iY : Integer; class function GetX : Integer; static; class procedure WriteX(const iValue : Integer); static; public { Public declarations } class function GetSystemTime : String; static; class property X : Integer read GetX write WriteX; end;
A Object Pascal/Delphi Language Sample Program
class function TForm1.GetX : Integer; begin Result := TForm1.iX; end; class procedure TForm1.WriteX(const iValue : Integer); begin if (iValue <> TForm1.iX) then
TForm1.iX := iValue; end; procedure TForm1.Button1Click(Sender: TObject); begin Button1.Caption := TForm1.GetSystemTime; TForm1.X := 999; Button2.Caption := IntToStr(TForm1.X); end;
一般 Delphi 程式如何移植到 .NET
現在使用 Dfm2Pas/Dccil即可轉換大部份的一般程式
未來在 Delphi 8的 IDE中重新 Compile即可 一般的語法將轉為 Delphi語法 ,資料型態將轉為 CLR/CLS資料型態
對於Win32 API的呼叫將藉由 .NET的 InterOp呼叫
DLL/COM/COM+/ActiveX 元件和 .NET 程式
A DLL Demo- 使用 DllImport Attribute
- //[DllImport('aviPlayer.dll', CharSet=CharSet.Ansi, EntryPoint = 'PlayAVI')]
- //procedure PlayAVI(const sName : String); external;
A COM+ Demo
function TdDemoCOM.GetSystemInfo: WideString; begin Result := 'This is COM+ Object Right now is : ' + DateToStr
(now); end;
Demo Process
Step 1先為 COM+建立 Type Library wrapper Assembly- Tlbimp PDemoCOM.dll /out:PNETDemoCOM.dll
Step 2 使用 dfm2pas轉換 Delphi Client應用程式- Dfm2pas PCOMDemo.dpr PNETCOMDemo.dpr- Dfm2pas fmMain.pas fmNETMain.pas
Step 3修改 PNETCOMDemo.dpr, fmNETMain.pas Step 4 使用 dccil
- Dccil –v –luPNETDemoCOM PNETDemoCOM.dpr
.NET Framework
.NET Application
Your Application or Package
Etc. Etc.
.Web.Xml
.Windows.Data
System
Win32
.NET’s System.Windows.Forms
Win32
ComCtrls RichEd
Your Application or Package
SystemEtc. Etc.
.Web.Xml
.Data .Windows
User32
.NET Framework
.NET Framework
Delphi for .NET application
Win32
.Windows.FormsBorland.VCL
.XmlBorland System
.Web .Net.Data
Your Application or Package Your Application or Package
.NET Framework
Delphi for .NET application
Win32
.Windows.FormsBorland.VCL
.XmlBorland System
.Web .Net.Data
Your Application or Package Your Application or Package
BDE/IDAPI
Native drivers to various DataSource- Oracle, MS SQL Server, InterBase, dBase, Paradox…
在 .NET中仍然可以使用 BDE/IDAPI嗎 ?- 是的 , 但是僅限於 BDE/IDAPI最後支援的資料庫和版本
VCL.NET藉由 InterOp允許 .NET程式存取 BDE/IDAPI
BDE/IDAPI
a .NET 應用程式
.NET InterOp Technology
IDAPI32.DLL
Sqlora8.dll Sqlmss32.dll Sqldb232.dll Idpdx32.dll.dll …
BDE/IDAPI
Borland.VCL.DB, Borland.VCL.BDE.DbTables, Borland.VCL.CDS.DBClient, Borland.VCL.DBGrids, Borland.VCL.DBCtrls;
Midas
Delphi 8會移植Midas- Borland.Db.CDS.DBClient- Borland.Db.CDS.DSIntf- Borland.Db.CDS.Mconnect- Borland.Db.CDS.Midas- Borland.Db.CDS.Provider- Borland.Db.CDS.TConnect
The Target: C++ Developers
ProfessionalProfessionalDevelopersDevelopersWorldWideWorldWide
1M1M
2M2M
3M3M
20002000 20012001 20022002 20032003 20042004 20052005
COBOLCOBOL
Visual BasicVisual Basic
C++C++
JavaJava C#C#
DelphiDelphi
C++ will remain the largest community through 2005
Source: IDC
Current Trends in the C++ market
Large effort in maintenance of C++ code Multi-platform supported applications Mobile and Embedded support is strong C++ is preferred for performance
computing Microsoft focus on managed code Migration from Unix to Linux on Intel The C++ standard is evolving.
Mobile tools
Device Drivers/Hardware SpecificProgramming
Operating System FeatureProgramming
System LibrariesConnectivity and DB access
Re-usable componentDevelopment
Rapid ApplicationDesigners and Wizards RAD Tool
System DevTools
Enabling C++ Developers
Project IRIS
XplatformIDE
RAD Tool
ALM tools
StarTeamTogether
Multi-toolchain
C++BuilderX Overview
Multi-platform IDE- Same PrimeTime IDE (and look and feel) as JBuilder- Windows, Linux, Solaris
Multiple compiler toolchain support- Supports Borland, Microsoft, GNU, Metrowerks, Intel, Sun Forte- New Borland 100% ANSI/ISO C++ and C99 compliant compiler
ALM integration- Caliber, Together, StarTeam, Visibroker, Interbase- Intel VTune Performance Analyzer, InstallShield MultiPlatform
Visual Development environment- Pure C++ RAD framework and designers
Mobile solutions- Supports any Symbian SDK
C++BuilderX ALM Integration
Same level of integration as offered in JBuilder 9- Caliber read-only client in Together- Together Touch-Point integration- StarTeam SCM advanced integration- Intel VTune Performance Analyzer*- VisiBroker 5.2 integration- Interbase 7.1 support- InstallShield MultiPlatform*
Together® Edition for C++BuilderX™ Overview
Provides an integrated and agile UML development environment using the C++BuilderX environment.
Adds ease in designing and working with classes, the core of C++
Creates visual models from code and keeps models and code automatically synchronized
Provides audits and metrics capabilities to improve and measure quality of applications
20 years of ‘Turbo Charging’
Software Development Excellence
20 years of support for
Microsoft operating systems, technologies, and initiatives.
1983-2003
Top Related