ISV Community Day Best Practice Per Ahlberg Developer Evangelist Developer & Platform Evangelism Microsoft Sweden.

Slides:



Advertisements
Similar presentations
Microsoft SharePoint 2010 technology for Developers
Advertisements

ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Introduction to Database Processing with ADO.NET.
Kashif Jalal CA-240 (072) Web Development Using ASP.NET CA – 240 Kashif Jalal Welcome to week – 2 of…
Advanced Object-Oriented Programming Features
ASP.NET Programming with C# and SQL Server First Edition
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Objective In this session we will discuss about : What is ADO. NET ?
Visual Basic 6.0 Derived from BASIC Developed by Microsoft in 1998 An event driven programming language Associated with a development environment.
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
UNIVERSIDAD TECNOLÓGICA ECOTEC. ISO 9001:2008 Module 2 Creating Web Applications by Using Microsoft® Visual Studio 2010 and Microsoft.NET–Based Languages.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Overview of Microsoft.Net and Vb.Net ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction.
Copyright © 2009 by SDL Tridion. SDL Tridion®, SDL Tridion R5™, BluePrinting™, SiteEdit™ and WebForms™ are trademarks of SDL Tridion Holding B.V. or its.
Introduction to the Enterprise Library. Sounds familiar? Writing a component to encapsulate data access Building a component that allows you to log errors.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Deployment of web Site. Preparing the web site for deployment you now have two versions of web site 1 -one running in the production environment 2-one.
ASP.NET INTRODUCTION INTO وزارة التربية و التعليم العالي كلية العلوم و التكنولوجيا قسم علوم الحاسوب و تكنولوجيا المعلومات اعداد الاستاذ: عبد الله محمد.
ASP.NET The.NET Framework. The.NET Framework is Microsoft’s distributed run-time environment for creating, deploying, and using applications over the.
.NET Framework & C#.
Gary Blatt GB Consulting Specializing in.Net training and development (972)
 Internet providing backbone for applications  Use of several web sites and devices to provide one complete solution  Software as services  Quick software.
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
Visual Studio ®.NET Data with XML Carlotta Eaton ( Associate Professor of IST New River Community College Slides by Microsoft Modified.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
Nilotpal Bhattacharya Partner Technical Consultant| Microsoft.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Introduction to ASP.NET 1www.tech.findforinfo.com.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
ASP.NET application. Roadmap ASP.NET file types Bin directory Application updates Simple application from start to finish using a virtual directory Behind.
DEV325 Deploying Visual Studio.NET Applications Billy Hollis Author / Consultant.
Slide 1.NET Development for Project 2003 Samples from the Project 2003 SDK Jim Corbin Programmer Writer Office Developer Documentation Microsoft Corporation.
.Net – The First Glance What Is.Net, Why Use.Net.
Lesson 2 What is ASP.NET? What is ASP.NET? What is Web Matrix? What is Web Matrix? What are the features of Web Matrix? What are the features of Web Matrix?
From DNA to.NET Design Path. Objectives Sketch up a typical Win DNA Application Sketch up the.NET version Compare Design and Implementation Advantages.
Windows Forms in Visual Studio 2005 Mike Pelton Systems Engineer Microsoft Ltd
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
JDS – VB.NET Skill Session Fall 2004 Presented by YUHAO LIN.
VB6 Migration to.NET Sean Puffett Developer & Platform Group Microsoft Ltd
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
Building High Performance, Robust Server Applications with Internet Information Server 5.0 Van Van IIS - Program Manager Microsoft Corporation.
Key Components of.NET Framework  Common Language Runtime  CLR at Design time  CLR at Runtime  Class Library  Assemblies  Namespaces  ASP.NET  Applications.
PRIOR TO WEB SERVICES THE OTHER TECHNOLOGIES ARE:.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
.NET Ying Chen Junwei Chen. What is Microsoft.NET. NET is a development platform Incorporated into.NET COM+ component services ASP web development framework.
ASP. NET Differences Dave Webster EMEA Technical Team dave
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Migrating ASP to ASP.NET Matt Gibbs ASP.NET Development Manager.
CIS 375—Web App Dev II ASP.NET 1 Getting Started.
INTRODUCTION CHAPTER #1 Visual Basic.NET. VB.Net General features It is an object oriented language  In the past VB had objects but focus was not placed.
Introduction to.NET Building.NET Applications Mike Taulty Developer & Platform Group Microsoft Ltd
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Database Processing with ADO.NET
Lecture 6 VB.Net SQL Server.
ADO.NET Accessing Databases in VS.NET
Moving from ASP to ASP.NET
Web Development Using ASP .NET
Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta
Presentation transcript:

ISV Community Day Best Practice Per Ahlberg Developer Evangelist Developer & Platform Evangelism Microsoft Sweden

Agenda General Best Practices COM Components best practice Data layer best practice ASP to ASP.NET Best Practices

General Migration Strategy Identify the parts of the application that you have to migrate Plan very carefully and try to have minimal impact on the existing application during the migration In a multi-tier scenario, take the horizontal or vertical approach  Horizontal – migrate the whole tier (middle/presentation) at the same time  Vertical – migrate some pages, some components, at the same time Decide if you want to reuse existing COM components

Migration Best Practices Data access related  If you have a data access tier, move it into.NET COM related  Always use early binding  Explicitly free resources from code Project management related  Keep two code trees while migrating, and make sure to update both of them while adding changes to the existing Web site  First try to modify the existing code as it is  After you complete this, try to modify the application to use the advantages provided by.NET

Migration Best Practices Testing related  Update existing links to your Web site/pages because the file name extension is now.aspx  Use a link checker to check any broken links, images, paths, and so on  Test very well

Migrating Applications that Use COM Components COM related changes:  ASP.NET uses MTA instead of STA  Pages with STA components may or may not perform well  Early binding is preferred in ASP.NET  Cannot use ASPCOMPAT with WebServices COM Interop  Can use all your former COM components  Use ASPCOMPAT keyword if you plan to use existing STA components in ASP.NET  Use ASPCOMPAT only when using STA objects or when your COM objects access ASP intrinsic objects

Migration Best Practices Language related  Strongly type all the variables  If possible, convert all the On Error statements to try catch blocks  Remember that they may not be as easy as they look  Use call keyword for function calls and use parenthesis for function and subroutine calls  Identify default properties and replace them appropriately  Always use Option Explicit Remove Microsoft.VisualBasic namespace

ADO  ADO.NET ADO evolves into ADO.NET DataReader DataAdapter DataSet Command Connection RecordSet Command Connection

Migrating Applications that Use Databases Data access changes  ADO (through Interop) can be used, but Microsoft does not recommend it  ADO and ADO.NET are quite different  ADO.NET is not exactly backward compatible  Three main objects in ADO.NET: DataSet, DataReader, and DataAdapter  Built-in designer support for ADO.NET objects in Visual Studio.NET

Migrating Applications that Use Databases Strategies  Rewrite ADO code in ADO.NET instead of migrating  Keep ADO code as a short term approach  If you use ADO code in ASP pages, use Primary Interop Assembly for ADO on both the developer box and the server  If you need read-only data, use a DataReader High level strategies:  Replace VB6 components directly by VB.NET components, horizontally or vertically  Let ASP.NET call Web Services that encapsulate VB6 business components, then migrate these as needed to.Net

Replacing VB6 components directly Your.NET code can talk directly to VB6 COM code, but... If your VB6 business components require passing variants, write strongly-typed “inbetween”.Net components (adapters)  ASP.NET talks to the inbetween components  The inbetween components talk to the existing VB6 components and perform data conversion to strong types

VB6.MyWeakComponent: Public Function UpdatedData(Name As String, Age As Variant, MyDataArray As Variant) As Variant VBNet.MyStrongComponent: Public Function UpdatedData(Name As String, Age As Integer, MyDataArray As Array Of Single) As Double In version 1, VBNet.MyStrongComponent calls VB6.MyWeakComponent and performs type conversion as needed Replacing VB6 components directly

.NET VB6 comp.NET VB.NET comp VB6 comp Before After Business logic Adapter logic Business logic Replacing VB6 components directly

By building these adapter components,.NET code can be fully typed as needed and the UI can be completely replaced As a next step, you can change the VB.NET Business components to replace the VB6 business components   You have now replaced your Business logic layer Replacing VB6 components directly

Migrating Applications that Use COM Components COM related changes: .NET uses MTA instead of STA  ASP.NET Pages with STA components may or may not perform well  Early binding is preferred in.NET  Cannot use ASPCOMPAT with WebServices COM Interop  Can use all your former COM components  Use ASPCOMPAT keyword if you plan to use existing STA components in ASP.NET  Use ASPCOMPAT only when using STA objects or when your COM objects access ASP intrinsic objects

If your original VB6 code returned ADO Recordsets, it is best to make the VB.NET versions return ADO.NET DataSets instead:  Convert ADO Recordsets to ADO.NET DataSets as needed in the Business layer  ASP.NET then works only with ADO.NET  Many ASP.NET Web Controls work with DataSets  ADO.NET DataSets can be marshalled efficiently even across physical tiers Replacing components layer by layer

Later, migrate the Data layer and make it return ADO.NET DataSets instead of ADO Recordsets Remove the Recordset  DataSet conversion code from the Business components For components you can’t migrate, stick to COM Interop

Replacing components layer by layer What about transactional integrity and security context?  In VB6 under Windows NT: MTS  In VB6 under Windows 2000: COM+  In.NET: COM+

Replacing components layer by layer Derive your façade components from the ServicedComponent base class to use COM+ transactions and security  Interestingly, the components that a ServicedComponent calls don’t need to be serviced – they use the caller’s context! Use attributes to control configuration  Best to put them in the AssemblyInfo.vb file Register your façade’s assembly in the GAC

Wrapping VB6 components by.NET Web Services Alternatively, start by having your ASP.NET pages consume.NET Web Services that wrap the VB6 components This allows for easy separation in physical tiers (dedicated application servers) as well as logical tiers A better option to separate in physical tiers is to use.Net Remoting If you need transactional integrity across physical tiers, use Serviced Components

.NET VB6 comp.NET Before After Business logic Adapter logic Business logic ASP.NET Web Service Physical boundary Wrapping VB6 components by.NET Web Services

.NET VB6 comp.NET VB.NET comp Before After Business logic Wrapper logic Business logic ASP.NET Web Service Physical boundary Wrapping VB6 components by.NET Web Services

Web Services use open standards You can open your business logic to other applications as well, over the Internet, if you want But be careful: Web Services can be transactional, but only as the transactional root  You can’t combine more than 1 Web Service into a transaction Wrapping VB6 components by.NET Web Services

ASP VB6 comp.NET Replacing VB6 components indirectly with Remoting Before After Business logic Physical boundary VB.NET comp Adapter logic

Replacing VB6 components indirectly with Remoting Remoting is “.Net DCOM” Better performance than with Web Services  We measured TCP binary remoting to provide 200%-300% the speed of web services with SOAP Calling a component through remoting does not maintain transactional integrity and security context, however Remoting only works from.Net to.Net

COM Best Practice Use Primary Interop Assemblies  Produced by COM API owner  May be modified for correctness or managed client friendliness  Recognized by Visual Studio.NET  Ensure consistent identity for Interop types Visual Studio ships with PIAs  C:\Program Files\Microsoft.NET\Primary Interop Assemblies Office 2003 PIAs also available  asp asp

Contain structured data: ShoppingCart, UserProfile, Catalog Are classes that inherit from DataSet Inherit all DataSet’s standard functionalities Automatically copyable, mergable, serializable,... Can be autogenerated by the.NET framework’s xsd.exe tool Typed DataSets

ds.Tables(“Customers”).Rows(0).Columns(“Name”) _ = “Steve Ballmer” ds.Tables(“Customers”).Rows(0).Columns(“Name”) _ = “Steve Ballmer”Untyped ds.Customers(0).Name = “Steve Ballmer” Typed Typed DataSets Add properties specific to the structured data:  IntelliSense!

They don’t solve all your data modeling needs:  You still have to write code to populate them  Marshalling serializable objects (such as DataSets) rather than plain strings (such as XML strings) requires more CPU... but the simplicity and power of using DataSets more than makes up for it See IBuySpy reference implementation Typed DataSets

ASP to ASP.NET Best Practices General  If the application is relatively small, consider rewriting  If the application is very large, then plan carefully and migrate part by part  If you only want to make a syntactic port, then consider only ASPX pages (that is, not using the “code behind” model) and do not make unnecessary changes  You do not have to port the whole site at the same time  Consider migrating the slow/critical parts  Remember, you can run ASP and ASP.NET side-by-side  Try to migrate the read-only pages first  Write automated tools to do some tasks

Finally Best Practices... Use Enterprise Templates that implement and force good coding practices Use.Net’s standard naming conventions Use structured exception handling Use Typed DataSets rather than “generic” DataSets whenever possible  It’s not the ultimate panacea but it’s better than generic DataSets for strong typing and IntelliSense