Introduction to .NET Siddhesh Bhobe
Agenda What is .NET? .NET framework and building blocks ADO.NET Web Services in .NET DNA to .NET Migration
What is Microsoft .NET? From the Microsoft site: “ Microsoft .NET is Microsoft’s XML Web services platform. .NET contains all that’s needed to build and run software based on XML, the lingua franca of Internet data exchange.”  .NET includes: The .NET Platform , which is a set of programming tools and infrastructure to enable the creation, deployment, management, and aggregation of XML Web services.  .NET experiences (applications!) , which are the means for end users to interact with .NET.
The .NET Platform NET Framework and Visual Studio .NET   Server infrastructure Application Center 2000;  BizTalk™ Server 2000; Host Integration Server 2000; Mobile Information 2001 Server; and SQL Server™ 2000 Building block services They include Passport (for user identification) and services for message delivery, file storage, user-preference management, calendar management, and other functions.  Smart Devices Enables PCs, laptops, workstations, smart phones, handheld computers, Tablet PCs, game consoles, and other smart devices to operate in the .NET universe.
The .NET Framework
1 st  generation web applications OS  Services Microsoft  provided IIS, IE and COM Applications largely operating in a client / server model were augmented with web browser and servers.  Browsers Web app developers took advantage of these local services  and used HTML to “project” the UI to many types of clients. Servers Data, Hosts UI Logic Biz Logic
2 nd  generation of web applications Combination of “stateless” Web protocols with DNS and IP routing have enabled mass-scale “Geo-Scalability” “ Stateful” “ Stateless” & “ Geo-Scalable” OS  Services Biz Logic Tier Rich Client  UI Logic Servers Data, Hosts Richer  Browsers Separation of data and business logic provide greater scalability and performance while accessing enterprise data.  *COM+ Services improve reliability, scalability and manageability. *DHTML for better interactivity.
Next Generation Applications Richer, More Productive User Experience Applications Become  Programmable Web Services Standard Browsers Open Internet  Communications Protocols  (HTTP, SMTP, XML, SOAP)  Applications Leverage Globally-Available Web Services Smarter Clients Smarter Devices OS  Services Biz Tier Logic Biz Logic  & Web Service OS Services Public Web Services Building Block Services Internal Services XML XML XML Servers Data, Hosts XML Other Services XML XML XML HTML
Development/Deployment  headaches Non-consistent programming model Knowledge of plumbing code DLL management issues –’DLL HELL’ Resource management Non-consistent error handling Deployment issues Security
Couldn’t we have this! No “plumbing” is needed and objects can directly interact Components are built on a “common” substrate.
Couldn’t we have this! Enables shared services: GC, exception handler, security, threading, debugging…
Couldn’t we have this! Common API: IO, Collections, XML, UI… … across all languages
How Much Simpler? HWND hwndMain = CreateWindowEx( 0, "MainWClass", "Main Window", WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL);  ShowWindow(hwndMain, SW_SHOWDEFAULT);  UpdateWindow(hwndMain); Form form = new Form(); form.Text = "Main Window"; form.Show(); Windows API .NET Framework
Architecture Visual Studio.NET Windows COM+ Services Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Windows Forms Common Language Specification VB C++ C# JScript …
Common Language Runtime VB Source code Compiler C++ C# Compiler Compiler Assembly IL Code Assembly IL Code Assembly IL Code Operating System Services Common Language Runtime JIT Compiler Native Code Managed code Unmanaged Component
Compilation Source Code C++, C#, VB or any .NET language Metadata IL  Managed  code Resources myprogram.DLL Assembly is basic deployable unit in .NET  VS.NET Csc.exe, vbc.exe, etc. Compiler Assembly DLL or EXE
Assemblies The Building Block Deployment unit for types and resources:  a “logical dll” Self describing through a manifest Fundamental unit of versioning, reuse, deployment and permission grants and requests
ADO.NET
ADO.NET Architecture OdbcConnection OdbcCommand OdbcDataAdapte r Odb cDataReader ODBC .NET Data Provider COM Inter op ODBC
ADO.NET
Making Database Connection Using SQL Server .NET data provider. SqlConnection connSql=new SqlConnection ("Address=dotsrv;uid=sa;pwd=sql;connect Timeout=5;"); Using OLEDB.NET Provider to connect to Oracle OleDbConnection connOle=new OleDbConnection ("Provider=OraOLEDB.Oracle.1;Data Source=_CRUISEDB;  user id=xat;password=xat;");   Using ODBC.NET Provider to connect to Oracle OdbcConnection connODBC=new OdbcConnection ("DSN=connectOra;Server=_CRUISEDB;uid=xat;pwd=xat;");
ADO and XML in the .NET Framework Managed Provider DataReader Command Connection Sync Controls, Designers, Code-gen, etc DataSet XmlReader XSL/T, X-Path,  etc XmlData- Document DataAdapter
DataSet Relational View of Data Tables, Columns, Rows,  Constraints Navigate between tables  using Relations DataRow[] orders = customer.GetChildren("custOrd"); Source-agnostic XML, Relational, Application data Remotable No knowledge of source of data Never holds connection state DataSet as argument to WebMethods Serializes as XML Schema/Data DataSet Tables Table Columns Column Constraints Constraint Rows Row Relations Relation
Example: Reading/Writing XML   // Load DataSet with XML DataSet ds = new DataSet(); ds.ReadXml("inventory.xml"); // Add a record to the Inventory table DataTable inventory = ds.Tables["Inventory"]; DataRow row = inventory.NewRow(); row["TitleID"]=1; row["Quantity"]=25; inventory.Rows.Add(row); // Write out XML ds.WriteXml("updatedinventory.xml");
Example: Associating an XmlDataDocument with a DataSet private static XmlDataDocument xmlData; public static DataSet LoadDataSet(String schema) { DataSet ds = new DataSet(); ds.ReadXmlSchema(schema); xmlData = new XmlDataDocument(ds); xmlData.Load("po.xml"); return ds; } public static void SaveChanges() { xmlData.Save("po.xml"); }
Example: X/Path over Relational public static void doXml(DataSet po)  { // Associate an XmlDataDocument with the DataSet XmlDataDocument xmlData = new XmlDataDocument(po); // Do an X/Path Query  XmlNodeList nodes = xmlData.SelectNodes("//Item[@qty>100]"); // Write out results Console.WriteLine("Matches="+nodes.Count); foreach(XmlNode node in nodes)  {   DataRow row =  xmlData.GetRowFromElement((XmlElement)node);   // Mark Customer for Deletion   row.Delete(); } }
Example: XSL/T over Relational public static void doTransform(DataSet po) { XmlDataDocument xmlData = new XmlDataDocument(po); // Do a Transform XslTransform xsltransform = new XslTransform(); xsltransform.Load("po.xsl"); XmlReader xReader = xsltransform.Transform(xmlData, null); }
Summary ADO.NET provides a model for bridging the gap between XML and Relational data DataSet provides Relational View  Persists/loads data as XML Persists/loads schema as XSD Serializes as XML with in-line schema XmlDataDocument provides an XML view Exposes relational data to XML tools Exposes a relational subset of XML data Preserves Fidelity of XML
Web Services in .NET
Web Services are “Key” in .NET
Web Services Infrastructure in .NET IIS and COM+ provides the hosting environment APIs COM for implementing the business façade, business logic, and data access layers ADO, OLE DB, and ODBC for implementing data access to a variety of data stores MSXML to help construct and consume XML messages in the Web Service listener Active Server Pages (ASP) or ISAPI for implementing the Web Service listener  NLBS and Clustering for scalability IPSec, HTTP Basic authentication, Digest authentication, Kerberos 5 authentication, NTLM authentication, or your own custom scheme.
.NET Web Services Infrastructure Smart Clients and Devices to consume Web Services Suite of .NET Servers, including Win 2K family and .NET Enterprise Servers Development Tools VS.NET Single unified IDE for all languages Enable applications as Web Services Aggregate Web Services .NET Framework Build, deploy and run Web Services
Service Description Uses WSDL to describe itself Uses namespaces to uniquely identify service endpoints Server-side component that map Web Services to COM components using WSDL and Web Services Meta Language (WSML) description
Service Implementation Several languages running on Common Language Infrastructure: VB.NET, C#, JScript SOAP Toolkit for constructing, transmitting, reading and processing SOAP messages
Service Publishing, Discovery and Binding Used to have DISCO for discovering Web Services Now supports UDDI Provides .NET UDDI server Office XP offer support for service discovery through UDDI
Service Invocation and Execution Use of built-in .NET SOAP message classes Construct Web Service listeners using MSXML, ASP, ISAPI etc Use SOAP toolkit to build a Web Service listener Client-side components for invoking Web Services
Creating and Consuming Web Services in VS.NET
Create New ASP.NET Web Service Project
Project and Sample Files created
Add New Web Service to the Project
default.asmx <%@ WebService Language =&quot;vb&quot;  Codebehind =&quot;default.asmx.vb&quot;  Class =&quot;DegreesWebService._default&quot;  %>
default.asmx.vb
What makes this a web service? &quot;Imports System.Web.Services&quot; brings in the functionality needed under this class.  &quot;<WebService(Namespace := &quot;http://tempuri.org/&quot;)> _&quot; makes this class callable from the web.  &quot;Inherits System.Web.Services.WebService&quot;, makes this class inherit all the methods and properties of this class.  &quot;<WebMethod()>&quot; in front of a method makes this callable from the web.
Our Web Service
Building and testing the web service Make sure that our starting page for the project is the  default.asmx  page Then go to  Debug > Start , or press  F5 . VS builds the project and pops up a web browser window with this file.  This is simply a medium that Microsoft has provided so that we can test our Web Service.
Testing a web service
Enter Values…
Invoke…
Add Web Reference
Web Reference added
Modified default.aspx
Code behind
More… http://www.devasp.net/net/search/default.asp?c_id=534 http://www.xefteri.com/articles/nov182002/default.aspx http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchgettingstartedwithxmlwebservicesinvisualstudionet.asp
DNA to .NET Migration
Windows DNA architecture Windows NT 4/Windows 2000 COM COM COM IIS ASP SQL
.NET Framework Common Language Runtime Managed data and code Unified framework library Multiple language support #include <stdio.h> int main()  { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } #include <stdio.h> int main()  { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } #include <stdio.h> int main()  { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } 0010 1100 0101 1010 1100 0011 1111 0101  1010 0101 0000 0000 1000 1011 0101 0000 1111 1100 0100 1101 0101 1010 1100 0011 MSIL CLR VB C# COBOL
DNA to .NET mappings Presentation tier mapping Web Tier  - ASP to ASP.NET Rich client – Win32API to WinForms Middle tier mapping Components – COM to .NET Connectivity – DCOM to CLR Remoting Connectivity – ADO to ADO.NET Language mapping VB6 to VB.NET C++ to C#
Presentation tier mapping ASP to ASP.NET Separate code behind Inline code/presentation Config changes are automatically detected and applied Changes require web server restart or OS reboot Simple xcopy or FTP upload can handle deployment Registration required to deploy site Access to entire Framework Access to limited API Built in session state User managed session state  VB.NET, C#, COBOL.NET, … VBScript and JavaScript Compiled code Interpreted code ASP.NET ASP
Migration issues ASP.NET requires IIS5 No migration tools available from ASP to ASP.NET ASP and ASP.NET co-exist Application/Session variables not shared Global.asa vs. Global.asax
Rich Client Migration Existing frameworks C++/MFC library Visual BASIC UI .NET “Smart” client Unified Windows Form RAD environment Migration VB to VB.NET Wizard No migration from MFC to WinFrom
Recommendations C++ C++/MFC/ALT does not have a migration wizard.  Managed extension and new web service consumer capabilities can be used VB Upgrade wizard converts most of the code Watch out for unsupported features like Dynamic Data Exchange, OLE Containers etc.
Rich client benefits Managed code makes application more robust Utilizes unified framework libraries across languages Inherent support for ADO.NET and web services
Middle tier components COM Component 2 levels of support - VB and C++/ATL Registry complexities .NET Component Multiple language support – CLR Self contained – no dependencies Migration Source level migration – VB.NET Backward and forward compatibility between COM and .NET
DCOM Migration DCOM  Proprietary protocol Is not internet friendly .NET Remoting Based on standard protocol Completely flexible and configurable Supports multiple invocation mechanism Migration .NET uses DCOM protocol for backward compatibility
ADO to ADO.NET ADO COM based connectivity model Specification for interpreted environment Always connected scenario ADO.NET Common specs for .NET XML based dataset model Disconnected scenario Migration Backward compatibility to ADO ADO and ADO.NET can co-exist
Language Migration VB to VB.NET Wizard based Developer review required C++ to C++.NET Managed extension Native + managed code No wizard migration C++ to C# Complete rewrite required Fully Managed code Unsafe option
Migration strategies Partial web front migration Migrating Web front end while retaining business logic component Rich client migration Migrating Rich client to WinForms while retaining DCOM compatibilities Language level migration Using available wizards to migrate to .NET component from COM components
Partial web front migration Retain COM components Upgrade ASP to ASP.NET COM interop performance penalty COM COM COM IIS ASP IIS ASP
Rich client migration Retain COM components UpgradeWin32 to Winform COM interop performance penalty Win32 App .NET Winfrom COM COM COM
COM to .NET migration Migrate business logic Partial or complete rewrite Increased testing/debugging cycle VB to VB.NET Wizard migration C++ to managed C++.NET Manual C++ to C# rewrite COM .NET
Another way to look at it… VB6 Front End Component Access COM COM COM
Expose Your COM Components … External Apps VB 6 Web Service COM COM COM SOAP
Convert Front End …  VB 6 VB.NET VB 6 COM Interop Upgrade Tool Web Service External Apps COM COM COM SOAP
Convert COM to .NET … VB.NET Migration Tool .NET .NET .NET COM COM COM
Convert Fully …  VB.NET VB 6 .NET Interop Web Service External Apps .NET .NET .NET
Migration Notes ASP.NET give huge performance improvements over ASP Managed code (Winform, BL Components) are more robust then Win32/COM Everything need not be migrated at once Migration can be carried out in phases Post migration, application can be extended for different interface e.g. Mobile forms, web service, compact framework etc.
Useful Links http://www.microsoft.com/net http://www.gotdotnet.com http://www.sharpdevelop.org http://www.go-mono.com http://www.icsharpcode.net http://www.ecma.ch  (C# & CLI standard) http://www.dotnet247.com/

Introduction To Dot Net Siddhesh

  • 1.
    Introduction to .NETSiddhesh Bhobe
  • 2.
    Agenda What is.NET? .NET framework and building blocks ADO.NET Web Services in .NET DNA to .NET Migration
  • 3.
    What is Microsoft.NET? From the Microsoft site: “ Microsoft .NET is Microsoft’s XML Web services platform. .NET contains all that’s needed to build and run software based on XML, the lingua franca of Internet data exchange.” .NET includes: The .NET Platform , which is a set of programming tools and infrastructure to enable the creation, deployment, management, and aggregation of XML Web services. .NET experiences (applications!) , which are the means for end users to interact with .NET.
  • 4.
    The .NET PlatformNET Framework and Visual Studio .NET Server infrastructure Application Center 2000; BizTalk™ Server 2000; Host Integration Server 2000; Mobile Information 2001 Server; and SQL Server™ 2000 Building block services They include Passport (for user identification) and services for message delivery, file storage, user-preference management, calendar management, and other functions. Smart Devices Enables PCs, laptops, workstations, smart phones, handheld computers, Tablet PCs, game consoles, and other smart devices to operate in the .NET universe.
  • 5.
  • 6.
    1 st generation web applications OS Services Microsoft provided IIS, IE and COM Applications largely operating in a client / server model were augmented with web browser and servers. Browsers Web app developers took advantage of these local services and used HTML to “project” the UI to many types of clients. Servers Data, Hosts UI Logic Biz Logic
  • 7.
    2 nd generation of web applications Combination of “stateless” Web protocols with DNS and IP routing have enabled mass-scale “Geo-Scalability” “ Stateful” “ Stateless” & “ Geo-Scalable” OS Services Biz Logic Tier Rich Client UI Logic Servers Data, Hosts Richer Browsers Separation of data and business logic provide greater scalability and performance while accessing enterprise data. *COM+ Services improve reliability, scalability and manageability. *DHTML for better interactivity.
  • 8.
    Next Generation ApplicationsRicher, More Productive User Experience Applications Become Programmable Web Services Standard Browsers Open Internet Communications Protocols (HTTP, SMTP, XML, SOAP) Applications Leverage Globally-Available Web Services Smarter Clients Smarter Devices OS Services Biz Tier Logic Biz Logic & Web Service OS Services Public Web Services Building Block Services Internal Services XML XML XML Servers Data, Hosts XML Other Services XML XML XML HTML
  • 9.
    Development/Deployment headachesNon-consistent programming model Knowledge of plumbing code DLL management issues –’DLL HELL’ Resource management Non-consistent error handling Deployment issues Security
  • 10.
    Couldn’t we havethis! No “plumbing” is needed and objects can directly interact Components are built on a “common” substrate.
  • 11.
    Couldn’t we havethis! Enables shared services: GC, exception handler, security, threading, debugging…
  • 12.
    Couldn’t we havethis! Common API: IO, Collections, XML, UI… … across all languages
  • 13.
    How Much Simpler?HWND hwndMain = CreateWindowEx( 0, &quot;MainWClass&quot;, &quot;Main Window&quot;, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, (HWND)NULL, (HMENU)NULL, hInstance, NULL); ShowWindow(hwndMain, SW_SHOWDEFAULT); UpdateWindow(hwndMain); Form form = new Form(); form.Text = &quot;Main Window&quot;; form.Show(); Windows API .NET Framework
  • 14.
    Architecture Visual Studio.NETWindows COM+ Services Common Language Runtime Base Class Library ADO.NET and XML ASP.NET Windows Forms Common Language Specification VB C++ C# JScript …
  • 15.
    Common Language RuntimeVB Source code Compiler C++ C# Compiler Compiler Assembly IL Code Assembly IL Code Assembly IL Code Operating System Services Common Language Runtime JIT Compiler Native Code Managed code Unmanaged Component
  • 16.
    Compilation Source CodeC++, C#, VB or any .NET language Metadata IL Managed code Resources myprogram.DLL Assembly is basic deployable unit in .NET VS.NET Csc.exe, vbc.exe, etc. Compiler Assembly DLL or EXE
  • 17.
    Assemblies The BuildingBlock Deployment unit for types and resources: a “logical dll” Self describing through a manifest Fundamental unit of versioning, reuse, deployment and permission grants and requests
  • 18.
  • 19.
    ADO.NET Architecture OdbcConnectionOdbcCommand OdbcDataAdapte r Odb cDataReader ODBC .NET Data Provider COM Inter op ODBC
  • 20.
  • 21.
    Making Database ConnectionUsing SQL Server .NET data provider. SqlConnection connSql=new SqlConnection (&quot;Address=dotsrv;uid=sa;pwd=sql;connect Timeout=5;&quot;); Using OLEDB.NET Provider to connect to Oracle OleDbConnection connOle=new OleDbConnection (&quot;Provider=OraOLEDB.Oracle.1;Data Source=_CRUISEDB; user id=xat;password=xat;&quot;); Using ODBC.NET Provider to connect to Oracle OdbcConnection connODBC=new OdbcConnection (&quot;DSN=connectOra;Server=_CRUISEDB;uid=xat;pwd=xat;&quot;);
  • 22.
    ADO and XMLin the .NET Framework Managed Provider DataReader Command Connection Sync Controls, Designers, Code-gen, etc DataSet XmlReader XSL/T, X-Path, etc XmlData- Document DataAdapter
  • 23.
    DataSet Relational Viewof Data Tables, Columns, Rows, Constraints Navigate between tables using Relations DataRow[] orders = customer.GetChildren(&quot;custOrd&quot;); Source-agnostic XML, Relational, Application data Remotable No knowledge of source of data Never holds connection state DataSet as argument to WebMethods Serializes as XML Schema/Data DataSet Tables Table Columns Column Constraints Constraint Rows Row Relations Relation
  • 24.
    Example: Reading/Writing XML // Load DataSet with XML DataSet ds = new DataSet(); ds.ReadXml(&quot;inventory.xml&quot;); // Add a record to the Inventory table DataTable inventory = ds.Tables[&quot;Inventory&quot;]; DataRow row = inventory.NewRow(); row[&quot;TitleID&quot;]=1; row[&quot;Quantity&quot;]=25; inventory.Rows.Add(row); // Write out XML ds.WriteXml(&quot;updatedinventory.xml&quot;);
  • 25.
    Example: Associating anXmlDataDocument with a DataSet private static XmlDataDocument xmlData; public static DataSet LoadDataSet(String schema) { DataSet ds = new DataSet(); ds.ReadXmlSchema(schema); xmlData = new XmlDataDocument(ds); xmlData.Load(&quot;po.xml&quot;); return ds; } public static void SaveChanges() { xmlData.Save(&quot;po.xml&quot;); }
  • 26.
    Example: X/Path overRelational public static void doXml(DataSet po) { // Associate an XmlDataDocument with the DataSet XmlDataDocument xmlData = new XmlDataDocument(po); // Do an X/Path Query XmlNodeList nodes = xmlData.SelectNodes(&quot;//Item[@qty>100]&quot;); // Write out results Console.WriteLine(&quot;Matches=&quot;+nodes.Count); foreach(XmlNode node in nodes) { DataRow row = xmlData.GetRowFromElement((XmlElement)node); // Mark Customer for Deletion row.Delete(); } }
  • 27.
    Example: XSL/T overRelational public static void doTransform(DataSet po) { XmlDataDocument xmlData = new XmlDataDocument(po); // Do a Transform XslTransform xsltransform = new XslTransform(); xsltransform.Load(&quot;po.xsl&quot;); XmlReader xReader = xsltransform.Transform(xmlData, null); }
  • 28.
    Summary ADO.NET providesa model for bridging the gap between XML and Relational data DataSet provides Relational View Persists/loads data as XML Persists/loads schema as XSD Serializes as XML with in-line schema XmlDataDocument provides an XML view Exposes relational data to XML tools Exposes a relational subset of XML data Preserves Fidelity of XML
  • 29.
  • 30.
    Web Services are“Key” in .NET
  • 31.
    Web Services Infrastructurein .NET IIS and COM+ provides the hosting environment APIs COM for implementing the business façade, business logic, and data access layers ADO, OLE DB, and ODBC for implementing data access to a variety of data stores MSXML to help construct and consume XML messages in the Web Service listener Active Server Pages (ASP) or ISAPI for implementing the Web Service listener NLBS and Clustering for scalability IPSec, HTTP Basic authentication, Digest authentication, Kerberos 5 authentication, NTLM authentication, or your own custom scheme.
  • 32.
    .NET Web ServicesInfrastructure Smart Clients and Devices to consume Web Services Suite of .NET Servers, including Win 2K family and .NET Enterprise Servers Development Tools VS.NET Single unified IDE for all languages Enable applications as Web Services Aggregate Web Services .NET Framework Build, deploy and run Web Services
  • 33.
    Service Description UsesWSDL to describe itself Uses namespaces to uniquely identify service endpoints Server-side component that map Web Services to COM components using WSDL and Web Services Meta Language (WSML) description
  • 34.
    Service Implementation Severallanguages running on Common Language Infrastructure: VB.NET, C#, JScript SOAP Toolkit for constructing, transmitting, reading and processing SOAP messages
  • 35.
    Service Publishing, Discoveryand Binding Used to have DISCO for discovering Web Services Now supports UDDI Provides .NET UDDI server Office XP offer support for service discovery through UDDI
  • 36.
    Service Invocation andExecution Use of built-in .NET SOAP message classes Construct Web Service listeners using MSXML, ASP, ISAPI etc Use SOAP toolkit to build a Web Service listener Client-side components for invoking Web Services
  • 37.
    Creating and ConsumingWeb Services in VS.NET
  • 38.
    Create New ASP.NETWeb Service Project
  • 39.
    Project and SampleFiles created
  • 40.
    Add New WebService to the Project
  • 41.
    default.asmx <%@ WebServiceLanguage =&quot;vb&quot; Codebehind =&quot;default.asmx.vb&quot; Class =&quot;DegreesWebService._default&quot; %>
  • 42.
  • 43.
    What makes thisa web service? &quot;Imports System.Web.Services&quot; brings in the functionality needed under this class. &quot;<WebService(Namespace := &quot;http://tempuri.org/&quot;)> _&quot; makes this class callable from the web. &quot;Inherits System.Web.Services.WebService&quot;, makes this class inherit all the methods and properties of this class. &quot;<WebMethod()>&quot; in front of a method makes this callable from the web.
  • 44.
  • 45.
    Building and testingthe web service Make sure that our starting page for the project is the default.asmx page Then go to Debug > Start , or press F5 . VS builds the project and pops up a web browser window with this file. This is simply a medium that Microsoft has provided so that we can test our Web Service.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
    More… http://www.devasp.net/net/search/default.asp?c_id=534 http://www.xefteri.com/articles/nov182002/default.aspxhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchgettingstartedwithxmlwebservicesinvisualstudionet.asp
  • 54.
    DNA to .NETMigration
  • 55.
    Windows DNA architectureWindows NT 4/Windows 2000 COM COM COM IIS ASP SQL
  • 56.
    .NET Framework CommonLanguage Runtime Managed data and code Unified framework library Multiple language support #include <stdio.h> int main() { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } #include <stdio.h> int main() { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } #include <stdio.h> int main() { int a[100]; for (int x=0; x<100; x++) a[x]=x*x; for (int y=0; y<100; y++) a[y] = y*y; return 0; } 0010 1100 0101 1010 1100 0011 1111 0101 1010 0101 0000 0000 1000 1011 0101 0000 1111 1100 0100 1101 0101 1010 1100 0011 MSIL CLR VB C# COBOL
  • 57.
    DNA to .NETmappings Presentation tier mapping Web Tier - ASP to ASP.NET Rich client – Win32API to WinForms Middle tier mapping Components – COM to .NET Connectivity – DCOM to CLR Remoting Connectivity – ADO to ADO.NET Language mapping VB6 to VB.NET C++ to C#
  • 58.
    Presentation tier mappingASP to ASP.NET Separate code behind Inline code/presentation Config changes are automatically detected and applied Changes require web server restart or OS reboot Simple xcopy or FTP upload can handle deployment Registration required to deploy site Access to entire Framework Access to limited API Built in session state User managed session state VB.NET, C#, COBOL.NET, … VBScript and JavaScript Compiled code Interpreted code ASP.NET ASP
  • 59.
    Migration issues ASP.NETrequires IIS5 No migration tools available from ASP to ASP.NET ASP and ASP.NET co-exist Application/Session variables not shared Global.asa vs. Global.asax
  • 60.
    Rich Client MigrationExisting frameworks C++/MFC library Visual BASIC UI .NET “Smart” client Unified Windows Form RAD environment Migration VB to VB.NET Wizard No migration from MFC to WinFrom
  • 61.
    Recommendations C++ C++/MFC/ALTdoes not have a migration wizard. Managed extension and new web service consumer capabilities can be used VB Upgrade wizard converts most of the code Watch out for unsupported features like Dynamic Data Exchange, OLE Containers etc.
  • 62.
    Rich client benefitsManaged code makes application more robust Utilizes unified framework libraries across languages Inherent support for ADO.NET and web services
  • 63.
    Middle tier componentsCOM Component 2 levels of support - VB and C++/ATL Registry complexities .NET Component Multiple language support – CLR Self contained – no dependencies Migration Source level migration – VB.NET Backward and forward compatibility between COM and .NET
  • 64.
    DCOM Migration DCOM Proprietary protocol Is not internet friendly .NET Remoting Based on standard protocol Completely flexible and configurable Supports multiple invocation mechanism Migration .NET uses DCOM protocol for backward compatibility
  • 65.
    ADO to ADO.NETADO COM based connectivity model Specification for interpreted environment Always connected scenario ADO.NET Common specs for .NET XML based dataset model Disconnected scenario Migration Backward compatibility to ADO ADO and ADO.NET can co-exist
  • 66.
    Language Migration VBto VB.NET Wizard based Developer review required C++ to C++.NET Managed extension Native + managed code No wizard migration C++ to C# Complete rewrite required Fully Managed code Unsafe option
  • 67.
    Migration strategies Partialweb front migration Migrating Web front end while retaining business logic component Rich client migration Migrating Rich client to WinForms while retaining DCOM compatibilities Language level migration Using available wizards to migrate to .NET component from COM components
  • 68.
    Partial web frontmigration Retain COM components Upgrade ASP to ASP.NET COM interop performance penalty COM COM COM IIS ASP IIS ASP
  • 69.
    Rich client migrationRetain COM components UpgradeWin32 to Winform COM interop performance penalty Win32 App .NET Winfrom COM COM COM
  • 70.
    COM to .NETmigration Migrate business logic Partial or complete rewrite Increased testing/debugging cycle VB to VB.NET Wizard migration C++ to managed C++.NET Manual C++ to C# rewrite COM .NET
  • 71.
    Another way tolook at it… VB6 Front End Component Access COM COM COM
  • 72.
    Expose Your COMComponents … External Apps VB 6 Web Service COM COM COM SOAP
  • 73.
    Convert Front End… VB 6 VB.NET VB 6 COM Interop Upgrade Tool Web Service External Apps COM COM COM SOAP
  • 74.
    Convert COM to.NET … VB.NET Migration Tool .NET .NET .NET COM COM COM
  • 75.
    Convert Fully … VB.NET VB 6 .NET Interop Web Service External Apps .NET .NET .NET
  • 76.
    Migration Notes ASP.NETgive huge performance improvements over ASP Managed code (Winform, BL Components) are more robust then Win32/COM Everything need not be migrated at once Migration can be carried out in phases Post migration, application can be extended for different interface e.g. Mobile forms, web service, compact framework etc.
  • 77.
    Useful Links http://www.microsoft.com/nethttp://www.gotdotnet.com http://www.sharpdevelop.org http://www.go-mono.com http://www.icsharpcode.net http://www.ecma.ch (C# & CLI standard) http://www.dotnet247.com/