1 / 34

PWB517 PowerBuilder in .NET World

PWB517 PowerBuilder in .NET World. Xue-song Wu Staff Software Engineer Xue-song.wu@sybase.com August/2004. The Enterprise. Unwired. The Enterprise. Unwired. Industry and Cross Platform Solutions. Manage Information. Unwire Information. Unwire People. Adaptive Server Enterprise

claus
Télécharger la présentation

PWB517 PowerBuilder in .NET World

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PWB517 PowerBuilder in .NET World Xue-song Wu Staff Software Engineer Xue-song.wu@sybase.com August/2004

  2. The Enterprise. Unwired.

  3. The Enterprise. Unwired. Industry and Cross Platform Solutions Manage Information Unwire Information Unwire People • Adaptive Server Enterprise • Adaptive Server Anywhere • Sybase IQ • Dynamic Archive • Dynamic ODS • Replication Server • OpenSwitch • Mirror Activator • PowerDesigner • Connectivity Options • EAServer • Industry Warehouse Studio • Unwired Accelerator • Unwired Orchestrator • Unwired Toolkit • Enterprise Portal • Real Time Data Services • SQL Anywhere Studio • M-Business Anywhere • Pylon Family (Mobile Email) • Mobile Sales • XcelleNet Frontline Solutions • PocketBuilder • PowerBuilder Family • AvantGo Sybase Workspace

  4. Agenda • Overview of the PB to .NET compiler • Mapping PB features to .NET • PB WebForm for .NET • PowerScript enhancement

  5. Objectives of the PB to .NET Compiler • Compile PB applications as ASP.NET applications • Compile PB applications as Windows Forms applications. • Compile PB NVOs as .NET Web Services.

  6. WinForm/ WebForm Application PBL files C# Code Overview of PB to .NET Compiler pb2cs generates compiles References to PB System Library For .NET Main modules of the PB to .NET compiler

  7. PB system library for .NET • Implements all PB system classes and system functions in .NET programming languages. • No PBVM involved. • PBDWE.DLL, PBSHR.DLL, and DB drivers are needed.

  8. Assemblies of PB system library for .NET Sybase.PowerBuilder.Win.Dll Sybase.PowerBuilder.Web.Dll DataWindowControl Sybase.PowerBuilder.Common.Dll DataWindow Web Control 3rd party Web Controls Sybase.PowerBuilder.Interop.Dll PBSHR.Dll Sybase.PowerBuilder.Core.Dll DB Drivers

  9. Demo

  10. Mapping PB Features to .NET • PB Features • Data types (including nullness of variables) • Arrays • System classes and system enumerations • Event handling • Method invocation (dynamic/post) • Operators and expressions • Statements • Embedded SQL • DataWindow (dot notation) • External functions • COM • EAServer integration • PBNI

  11. PB Data types • Standard types: blob, boolean, char, date, datetime, decimal, double, int, long, real, string, time, uint, ulong, and longlong. • Any • Cursor and procedure • Nullness.

  12. Nullness • IPBValue public interface IPBValue { … bool Null { get; set; } … } • Defining a struct or a class that implement the IPBValue interface for each PB data type.

  13. Data type mapping

  14. System-defined enumerations • Enum names prefixed with “PB”. • Using Pascal naming convention for enum items. Powerscript: system type BorderStyle enumerated StyleBox! = 2 StyleRaised! = 6 StyleLowered! = 5 StyleShadowBox! = 1 end type C#: enum PBBorderStyle { StyleBox = 2, StyleRaised = 6, StyleLowered = 5, StyleShadowBox = 1 }

  15. System-defined classes • Class names prefixed with “PB”. • Using Pascal naming convention for member functions and instance variables. PowerScript: system type Throwable from NonVisualObject string Text end type function string getMessage() return text end function subroutine setMessage(String msg) text = msg end subroutine C#: class PBThrowable : PBNonVisualObject { public PBString Text; public PBString GetMessage() { return Text; } public SetMessage(PBString msg) { Text = msg; } }

  16. System-defined visual classes • Visual classes for WinForm. • Visual classes for WebForm. • Visual classes for mobile devices (in future)

  17. Event handling • PB events  .NET events. • PB event IDs  .NET delegates. • PB event handler  function that is registered to an .NET event.

  18. Other features • Embedded SQL – PBSQL class. • Dynamic/post method invocation - .NET reflection • COM. • EAServer integration • PBNI • External functions

  19. PB Windows Forms • Implemented using .NET Windows Forms controls. • No PBVM involved. • Make use of DataWindow.NET (supports dot notation)

  20. PB .NET Web Services • Generate .asmx file for PB NVOs

  21. PB WebForm for .NET • Rich internet application • Implemented on top of ASP.NET • Supporting most features of PowerBuilder

  22. Brief introduction to ASP.NET • Form-based programming method. • Event-driven programming • Ready-to-use Web controls that hide the details of HTML rendering. • State management • ASP.NET applications are compiled, and thus fast.

  23. ASP.NET page life cycle Image copied from http://www.dotnetguru/us/articles/JSFvsWebForms/JSFvsWebForms.html

  24. Moving to ASP.NET • PB WebForm Architecture (2-tier applications) PB App DB drivers Database PB application Web Brower ASP.NET PB WebForm App DB drivers Database Web Server PB WebForm application

  25. Moving to ASP.NET • PB WebForm Architecture (3-tier applications) PB Client App PB Components Database App Server PB application Web Brower ASP.NET PB WebForm App PB Components Database Web Server App Server PB WebForm application

  26. Page Model of PB WebForm • Each application has an aspx. page to represent the main window. • WebWindow • Web control: can contain menu, toolbar, and other child WebWindow controls. • Controls are added to the WebWindow controls dynamically. • All user’s logic runs at server side. <form id="Form1" method="post" runat="server"> <pb:DialogOpener id="dialogOpener" runat="server" Visible="False"> </pb:DialogOpener> <pb:WebMessageBox id="webMessageBox" runat="server“ Visible="False"> </pb:WebMessageBox> <asp:PlaceHolder runat="server" ID="mainWindow"></asp:PlaceHolder> </form>

  27. MessageBox • When a MessageBox is shown, the execution of script is suspended until the MessageBox is dismissed. • ASP.NET doesn’t provide a MessageBox control. • WebMessageBox control. st_1.text = "Showing MessageBox" messagebox("PB", "Hello world") st_1.text = "After showing MessageBox"

  28. Dialog (Response Window) • Dialog hell (http://weblogs.asp.net/jezell/archive/2003/08/26/25450.aspx). • DialogOpener Web control. • ShowDialogX.html and DialogX.aspx. st_2.text = "Showing Dialog" open(w_genapp_about) st_2.text = "After showing Dialog"

  29. Printing • Local printing: A PostScript or PDF file is generated at the server side, which is then downloaded to the client side for printing.

  30. Things worth mentioning • Only Button and LinkButton can trigger post back events immediately. Other events are queued up by the browser. • PB WebForm applications are stateful, and states are kept at server side • In-proc state management • No ViewState passing back and forth • Web Farms require Server Affinity • Out-of-process state management (in future release) • Failover

  31. Things not supported or working differently from PB • ActiveX • Visual – callable but not visible • Non-visual – callable • Avoid using STA (Single Thread Apartment) COM components (Requires Thread Affinity, setting ASPCompat to true) • File operations – happen at server side • Registry – probably not supported • Clipboard • Drag & drop • Hot keys, shortcut keys, and accelerate keys • Mouse move event

  32. PB to .NET Compiler • What you can do with it in PB11 • Deploy PB applications as WebForm/WinForm applications. • Deploy PB NVOs as .NET Web Services • What you can do with it beyond PB11 • Use .NET classes in PB. • Debug WinForm/WebForm applications in PB IDE

  33. PowerScript Enhancement • Parameterized constructors • StringBuilder • Bitwise operators (bitand, bitor, bitnot, bitxor) • Package & imports

  34. PB to .NET Compiler Q & A

More Related