Prologue to the Microsoft Framework for Delphi Developers .

Uploaded on:
Category: Business / Finance
2. Plan. Delphi and .NETWhat is the .NET Framework?.NET Framework Core FeaturesWriting .NET Managed CodeProgramming in Delphi for .NET. 3. Inceptions of .NET. The .NET Framework was affected by numerous dialects and frameworksBut there is no doubt that it looks a considerable measure like Delphi and the VCL. 4.
Slide 1

Prologue to the Microsoft .NET Framework for Delphi Developers

Slide 2

Agenda Delphi and .NET What is the .NET Framework? .NET Framework Core Features Writing .NET Managed Code Programming in Delphi for .NET

Slide 3

Origins of .NET The .NET Framework was impacted by numerous dialects and systems But there is no doubt that it looks a great deal like Delphi and the VCL

Slide 4

Delphi or .NET? Single-legacy Object Hierarchy Strongly Typed Formal idea of properties and occasions Consistent utilization of exemptions Reusable and extensible part display Formal thought of class interfaces Special DLLs containing metadata (RTTI) and code WinForms (VCL).

Slide 5

Migrating to .NET Shorter expectation to absorb information for Delphi engineers Already acquainted with protest situated programming Well versed in part arranged programming Comfortable expending and making occasions Already know the advantages of special cases and how to utilize them Do not need to discard existing Delphi improvement learning Delphi 8 gives an unmistakable movement way to .NET.

Slide 6


Slide 7

What is the .NET Framework? Virtual Machine Execution System The Common Language Runtime ( CLR ) Language-Neutral Class Library The Framework Class Library ( FCL ) Successor to Win32 Application Programming Model Competitor to Java Platform

Slide 8

Common Language Runtime Serves as the execution motor for oversaw applications Activates objects Performs security checks Manages memory portions and recuperation Executes code and so on

Slide 9

Framework Class Library Object-arranged API for composing oversaw applications Defines more than 7,000 sorts classes interfaces identifications delegates

Slide 10

.NET Framework Core Features Simplified & Consistent Programming Model Side-by-Side Execution and Versioning Simplified Deployment Multi-stage Support Programming Language Integration Garbage Collection Code Verification Consistent Error Handling Interoperability

Slide 11

Simplified Programming Model All working framework administrations got to through basic question situated programming model File Access Data Access Threading Graphics and so on. The CLR evacuates numerous awkward ideas Registry, GUIDs, IUnknown, HRESULTS, and so forth

Slide 12

Side-by-Side Execution/Versions The CLR permits application segments to be disconnected The CLR will dependably stack the segments that were utilized to be assemble and test the application. On the off chance that an application pursues establishment, it ought to dependably run Multiple adaptations of an application part might be introduced on a similar framework DLL forming issues (DLL Hell) are dispensed with

Slide 13

Simplified Deployment Installing most .NET applications includes Copying records to an index Adding an easy route to Start menu, desktop, or Quick Launch bar Registry get to no longer required No more GUIDs, ProgIDs, ClassIDs, and so forth. To uninstall, simply erase the documents

Slide 14

Multi-Platform Support .NET source code gathered to Common Intermediate Language (CIL) rather than customary CPU guidelines High-level CPU autonomous low level computing construct ~100 distinctive guidelines Direct support for protest sorts, special cases, and so forth. DCCIL gathers Delphi source code into CIL

Slide 15

Multi-Platform Support At runtime, the CLR makes an interpretation of the CIL into local CPU guidelines Resulting CPU directions are enhanced for the host processor A .NET application can be sent to any machine that has an ECMA-agreeable form of the CLR and FCL e.g. x86, IA64, Pocket PC, Linux (through Mono), and so on

Slide 16

Language Interoperability The CLR permits distinctive programming dialects to share sorts The CLR gives a Common Type System (CTS) Describes how sorts are characterized and how they act Specifies the principles for sort perceivability and individuals get to Single legacy - System.Object Common Language Specification (CLS) Defines the base arrangement of elements that every single .NET dialect that objective the CLR must support

Slide 17

CLR/CTS & CLS Relationship CLR/CTS C# Delphi CLS Others Each dialect bolsters A subset of the CLR/CTS A superset of the CLS

Slide 18

Garbage Collection The CLR consequently tracks all references to memory When a square of memory no longer has any "live" references to it, it can be discharged and reused (gathered) Impact – No deterministic demolition of articles IDisposable for discharging assets GC in the CLR canvassed in detail in February 2004 issue of The Delphi Magazine by Julian Bucknall.

Slide 19

Garbage Collection and Delphi Destructors in Delphi source code are converted into IDisposable example Free is still accessible in Delphi 8 Programming design for reference sorts same as before—utilize Free when wrapped up. start List := TStringList.Create; attempt . . . at long last List.Free;/Calls Dispose if executed end ;

Slide 20

Code Verification The CLR can check that all your code is sort safe The CLR guarantees that dispensed items are constantly gotten to suitably Correct number of parameters Correct sorts of parameters No improper memory get to and so on. The CLR likewise guarantees that execution stream will just exchange to understood areas Method section focuses

Slide 21

Consistent Error Handling Traditional Win32 programming consolidates various blunder dealing with instruments Status Codes GetLastError HRESULTS Structured Exceptions In the CLR, all disappointments are accounted for by means of Exceptions work crosswise over module and programming dialect limits A special case brought up in a Delphi class can be taken care of in a VB.NET exemption handler

Slide 22

Interoperability The .NET Framework bolsters interoperability with existing code and segments Managed code can call an unmanaged work in a DLL P/Invoke – Platform Invoke Managed code can utilize a current COM segment (server) Managed get together made from sort library Unmanaged code can utilize an oversaw sort (server) TlbExp.exe – Assembly to Type Library Converter RegAsm.exe – Assembly Registration Utility

Slide 23

Writing .NET Managed Code Managed Modules Assemblies Namespaces Manifests AppDomains Safe Code versus Dangerous Code

Slide 24

Managed Modules An executable intended to be controlled by the CLR Typically has EXE, DLL, or NETMODULE expansion Contains Windows Portable Executable (PE) File Header A CLR header Metadata depicting substance and outside conditions CIL guidelines produced from source code However, the CLR can\'t execute an oversaw module straightforwardly Must be a piece of a get together

Slide 25

Assemblies Logical gathering of at least one modules or documents Smallest unit of reuse, security, and forming Assemblies can be made Directly by compiler (e.g. DCCIL.exe, CSC.exe, VBC.exe) By joining existing modules utilizing AL.exe (get together linker) Satellite Assemblies Contain asset information (strings, symbols, and so forth.) Loaded at runtime in view of client region Note: The CLR loader considers a .NET executable is a get together

Slide 26

Assemblies and Delphi Very like Packages in Delphi actually, you make gatherings utilizing the Delphi bundle language structure requires statement records subordinate congregations (counting .NET Framework gatherings) contains provision records units to be incorporated Example RayKonopka.BorCon2004.Samples.dpk

Slide 27

Namespaces A namespace is a legitimate compartment for sorts Designed to take out name crashes Namespaces don\'t have any physical indication Unlike Java, they don\'t outline an index structure A get together can add to different namespaces Multiple gatherings can added to a namespace Examples System.Drawing System.Windows.Forms

Slide 28

Namespaces in Delphi A Delphi extend (program, library, or bundle) certainly presents its own particular namespace called the venture default namespace . A unit may unequivocally proclaim itself to be a piece of a namespace in the unit header unit RayKonopka.Common.StringUtils; Namespace = RayKonopka.Common.StringUtils A nonexclusive unit consequently turns out to be a piece of the venture default namespace unit RkStringUtils; Namespace = RayKonopka.BorCon2004.RkStringUtils

Slide 29

Multi-unit Namespaces One of the reactions of Delphi 8\'s support of namespaces is that different units can\'t have a place with the same namespace This is no longer an issue with Diamondback—the following adaptation of Delphi.

Slide 30

Manifests A XML portrayal of the substance and outer conditions of an oversaw module A show indicates the correct adaptation of a module that ought to be stacked to fulfill an outside reference Internal - Manifest can be implanted as asset External - Manifest record can be put in same index as executable. Must have same base filename as module. RayKonopka.Controls.dll.manifest

Slide 31

AppDomains An Application Domain is a setting in which at least one congregations might be stacked An AppDomain is the littlest granularity of code transfer You can\'t empty a get together You can empty an AppDomain, which will discard every one of the gatherings stacked into it By default, each oversaw executable will keep running in its own, different process that has only one AppDomain However, the CLR underpins stacking numerous AppDomains into a solitary procedure

Slide 32

AppDomain Boundaries Objects in one area can\'t be gotten to by code in another space Data go between areas must be marshaled over the area limit

Slide 33

Safe versus Perilous Code Managed code DOES NOT mean safe code Safe code will be code that is evidently sheltered PEVerify.exe Safe code does not shamefully get to memory does not call strategies with wrong parameters can\'t unfavorably influence another application\'s code and so on. Code that can\'t be confirmed is viewed as hazardous Call outer APIs (outside to .NET) Using pointers and other perilous sorts

Slide 34

Unsafe Types in Delphi Data sorts that work with pointers somehow are considered uns

View more...