Microsoft .NET - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Microsoft .NET

Description:

Microsoft .NET Junhui wang July 10, 2003 Outline Introduction to MS.NET .NET Framework What is MS .NET Old: .NET is the Microsoft platform for XML Web service. – PowerPoint PPT presentation

Number of Views:96
Avg rating:3.0/5.0
Slides: 51
Provided by: CharlesFi7
Learn more at: http://cs.lamar.edu
Category:

less

Transcript and Presenter's Notes

Title: Microsoft .NET


1
Microsoft .NET
Junhui wang July 10, 2003
2
Outline
  • Introduction to MS.NET
  • .NET Framework

3
What is MS .NET
  • Old .NET is the Microsoft platform for XML Web
    service.
  • New .NET is the set of Microsoft technologies
    for connecting your world of information,people,sy
    stems and devices.
  • .NET is infused into the Microsoft platform
    providing the ability to build,host,deploy and
    consume XML Web service connected solutions.

4
Why MS .NET
  • .Interoperability between languages and execution
    environments
  • .Uniformity in schema or formats for Data
    Exchange using XML,XSL
  • .Extend or use existing code that is valid
  • .Programming complexity of environment is reduced

5
Services provided by MS .NET
  • A new run-time environment, the .NET
    Framework
  • A new programming model for constructing HTML
    pages, named ASP.NET
  • A new way for Internet servers to expose
    functions to any client, named XML Web services
  • Windows Forms, a new way of writing rich client
    applications using the .NET framework
  • Support for db access within the .NET
    framework,namely ADO.NET
  • Support for handling XML documents and streams
  • A standardized mechanism for signaling
    asynchronous events
  • Support for writing multithreaded code
  • Support for writing your own Windows Forms
    and Web Forms controls

6
Component of MS .NET
  • .NET spans clients,servers and develop tools
  • .NET framework
  • .Developer tools
  • such as MS visual studio.NET 2003
  • . A set of servers
  • including MS Windows server 2003,MS
    SQL server
  • .Client software
  • such as Windows XP

7
What is .NET Framework
  • .NET framework is an integral Windows component
    for building and running all kinds of
    software,including web-based applications,smart
    client applications and XML Web services.
  • . Support over 20 different programming
    languages.
  • . Manages much of the plumbing involved in
    developing
  • software,enabling developers to focus on the
    core business logic code.
  • . Makes it easier than ever before to
    build,deploy,and administer secure,robust and
    high-performing applications.

8
Component of .NET Framework
  • . Common Language Runtime(CLR)
  • . A unified set of class libraries

9
.NET Framework Architecture
  • What is .NET anyway?

Microsoft .NET provides prefabricated
infrastructure for solving the common problems of
writing Internet software.
10
Common Language Runtime
  • Provide the common services for .NET framework
  • Run-time
  • .Language integration
  • .Security enforcement
  • .Memory management
  • .Process management
  • . Thread management
  • Developing time
  • .Life-cycle management
  • .Strong type naming
  • .Cross-language exception handling
  • . Dynamic binding reduce the amount of code

11
CLR Execution Model
Source code
VB
C
C
Unmanaged Component
Compiler
Compiler
Compiler
Managed code
Assembly IL Code
Assembly IL Code
Assembly IL Code
Common Language Runtime
JIT Compiler
Native Code
Operating System Services
12
Class Library
  • ASP.NET building Web applications and Web
    services
  • ADO.NET connecting applications to database
  • Windows Forms an environment for building smart
    client applications
  • System Class XML,security,network,messaging

13
  • ADO.NET

14
ADO.NET features
  • Designed for disconnected access
  • Can model data logically!
  • The DataSet replaces the RecordSet
  • DataSet can contain multiple tables

15
Core Concepts and Architecture
  • The ADO.NET Object Model
  • DataSet objects
  • Managed providers
  • ADO.NET-related Namespaces
  • System.Data
  • System.Data.ADO
  • System.Data.Internal
  • System.Data.SQL
  • System.Data.SQLTypes

16
ADO.NET Objects
.NET Applications
Data Set
Data Reader
Command Object
Connection Object
Managed Data Provider (OLEDB)
Database
17
ADO.NET and Managed Providers
  • A collection of classes for accessing data
    sources
  • Microsoft SQL Server 2000, SQL Server 7, and
    MSDE
  • Any OLE Database (OLE DB) providers
  • Including Oracle, JET, and SQL OLE DB Providers
  • Establish connection between DataSets and data
    stores
  • Two managed providers
  • ADO via the System.Data.ADO namespace
  • SQL Server via the System.Data.SQL namespace
  • System.Data.ADO is the ADO.NET managed provider

18
Connection with a Connection Object
  • A connection object represents a unique session
    with a data source.
  • Connection string database, OLE DB provider,
    password, etc.
  • Use the Open/Close method to open/close a
    connection.

19
Connection String
  • Containing information about database, OLE DB
    provider, password, if any, security, etc.
  • For Jet database
  • ProviderMicrosoft.Jet.OLEDB.4.0Persist Security
    info FalseData Sourcec\ \Nwind.mdb

20
Connection Object
  • Example
  • dim strConn as string "ProviderMicrosoft.Jet.OLE
    DB.4.0Data Source c\sales2k.mdb"
  • dim objConn as new ADOConnection(strConn)
  • objConn.open()
  • Basic Methods
  • Open, Close

21
Command Object
  • The command object allows us to execute a SQL
    statement.
  • Properties
  • CommandType SQL or stored procedure
  • CommandText SQL statement
  • Connection
  • Basic Methods
  • ExecuteReader Creates a DataReader object that
    contains the results of the query.
  • ExecuteNonQuery Execute SQLs INSERT, DELETE,
    UPDATE statements.

22
DataReader Object
  • It is read-only and forward-only cursor.
  • Basic Methods
  • Read Reads the current record and advances the
    pointer to the next record.
  • Close Closes the dataReader.

23
ADODataReader Sample
// Code for creating the ADOConnection adoConn
not shown String myQuery SELECT FROM
Customers adoConn.Open() ADOCommand myCmd
new ADOCommand( myQuery,adoConn ) // Declare the
ADODataReader... ADODataReader myDataReader //
Instantiate the ADODataReader with Execute(...)
... myCmd.Execute(out myDataReader) // Always
call Read before accessing data.
while(myDataReader.Read()) //code //
Always Close the reader and the connection when
done myDataReader.Close() adoConn.Close()
24
DataSet Object
  • A DataSet object can hold several tables and
    relationships between tables.
  • A DataSet is a set of disconnedted data. Data is
    extracted from the database and stored in the
    DataSet object. Updates to the DataSet must copy
    back to the database to make the changes
    permanent.

25
DataSet and Related Objects
DataView
DataSet
DataTable
DataTable
Command
DataAdapter
Connection
26
DataSet and Related Objects
  • DataSet Can contain multiple tables and
    relationships.
  • DataTable object Represents a table in the
    dataset.
  • DataAdapter This the object used to pass data
    between the database and the dataset. The Fill
    method copies the data into the dataset, and the
    Update method copies the updates back into the
    database.(datasetcom)
  • DataView This represents a specific view of the
    DataTables held in the dataset.

27
System.DataDataSet and XML
  • DataSet can read/write XML for its data and/or
    schema
  • Means You can create or modify a DataSet using
    XML!
  • XML-related DataSet methods for reading
  • ReadXml Reads an XML schema and data into the
    DataSet
  • ReadXmlData Reads XML data into the DataSet
  • ReadXmlSchema Reads an XML schema into the
    DataSet
  • And for writing WriteXml, WriteXmlData,
    WriteXmlSchema

28
Methods of Reading and Writing XML
// Code for creating the DataSet mds and loading
the // DataSet from a data source not shown.
String oFile C\\My_ADO.NET\\myXmlOutput.xsd
String iFile C\\My_ADO.NET\\myXmlInput.xsd
// Write the DataSets XMLSchema to an XML
Document mds.WriteXmlSchema( oFile ) //
Read/Upload XML Data into the DataSet mds.ReadXmlD
ata( iFile, true ) // Write the existing Data
to an XML Document mds.WriteXmlSchema(
C\\My_ADO.NET\\myXmlData.txt ) // Or output
the XML Data using the XmlData property! Console.W
riteLine( mds.XmlData )
29
  • ASP.NET

30
ASP.NET
  • ASP.NET is a new programming framework designed
    to make web apps easier to
  • Build, Deploy, Run
  • Radical advancement of todays ASP
  • Broader programming language support
  • Visual Basic.NET, Jscript.NET, C
  • Form-based programming model(similar to VB form)
  • Event driven programming
  • Programmable control
  • New application model
  • XML Web service
  • Mobile Web device support
  • Better reliability and recovery
  • Excellent Visual Studio support

31
ASP.NET Cont.
  • Improved performance scalability
  • ASP.NET is compiled, not interpreted
  • Rich output caching
  • Session state can now be shared across a web form
    of ASP.NET servers
  • .NET State Server Process manages state
  • ASP.NET detects and recovers from problems
  • Access violations, memory leaks, dead




















32
ASP.NET Application
  • Web formsbuilding powerful forms-based Web pages
  • XML Web Services providing the means to access
    server functionality remotely.
  • Combinations

33
Web Forms
  • The visual component(Web Form Pages)
  • consists of a file(.aspx extension)
  • (1)static HTML
  • (2) ASP.NET server controls
  • HTML server controls
  • Web server controls
  • Validation controls
  • user controls
  • (3) both.
  • The logic for the Web Form page(code)
  • separate file(.aspx.vb or .aspx.cs extension)

34
.NET Web Services
  • NET is built on Internet standard protocols
  • Uses Framework classes, such as
  • System.Web.Services
  • Enables communication through open standards
  • XML
  • Service description expressed with WSDL
  • SOAP
  • Basic wire format
  • Universal Description Discovery Integration
    (UDDI)
  • HTTP

35
Define XML Web Services
  • To create an XML Web service, simply write a .NET
    object as if it were being accessed directly by
    local clients, mark it with an attribute that
    says this object should be available to Web
    clients, and ASP.NET will do the rest.
  • ASP.NET automatically hooks up a prefabricated
    infrastructure that accepts incoming requests
    through HTTP and maps them to calls on the object

36
ASP.net for XML Web Services
  • Creating a Web service
  • 1. Create a file with an .asmx file name
    extension .
  • 2.Within the file ,declare the XML web
    service using directive
  • 3.Define the XML service methods that compose
    the functionality of the XML Web service
  • Creating a discovery file
  • Create a XML document with a .DISCO
    extension
  • (not compulsory to create)

37
Server-side view of XML Web services
Windows 2000 server machine
with .NET
  • HTTP requests arrive, with method name and
    parameters encoded in URL or separate XML.
  • 5. ASP.NET converts results to XML and returns to
    client via HTTP.

2. ASP.NET creates object specified in .ASMX file.
3. ASP.NET calls specified method on object.
.NET object Method 1..Method N
4. Object returns results to ASP.NET.
38
Client-side view of XML Web services
0. At programming time, a developer generates
proxyobject code from a description of an XML
Web service.
  • Client Program
  • At run time, client creates proxy object.
  • Client calls method on proxy.

Proxy 3. Proxy converts call to HTTP and XML and
sends it to server over the Internet. 4. Proxy
receives results in XML over HTTP and converts to
function return value.
To/from server via Internet
5. Client receives return value from proxy.
39
Example building a Web Service
  • lt_at_ WebService Language"VB" Class"TimeService"gt
  • Imports System
  • Imports System.Web.Services
  • Public Class TimeService Inherits WebService
  • ltWebMethod()gt Public Function GetTime
    (ShowSeconds as Boolean) As String
  • If (ShowSeconds TRUE) Then
  • return DateTime.Now.ToLongTimeString
  • Else
  • return DateTime.Now.ToShortTimeString
  • End if
  • End Function
  • End Class

40
Describing XML Web Services by WSDL File
  • To develop client applications that uses the XML
    Web services, programmers need a description of
    what the service does and how to use the service
    (e.g. methods exposed, parameters required by
    those methods, protocols supported)
  • Problem a universal approach not restricted to
    the MS world of describing a service is needed!
  • Solution The ASP.NET can generate such a
    description in the form of a WSDL (Web Service
    Description Language) file.
  • To obtain the WSDL file from ASP.NET, request the
    .asmx file with ?WSDL attached to the URL.
  • Alternatively, the developer can write the WSDL
    file first or obtain it from a 3rd party to
    describe what the service should do, and use the
    SDK utility program wsdl.exe to generate a
    template file.
  • The client application developer will probably
    not deal with raw WSDL files but rather use them
    through interpretive tools to develop client
    application.
  • The WSDL file also shows the supported protocols
    and how to access the service via these protocols
    from the client application.

41
Building XML Web Service Clients
  • ASP.NET funnels incoming requests to XML Web
    service objects packaged in 3 different ways
  • HTTP GET
  • HTTP POST
  • SOAP (Simple Object Access Protocol)
  • SOAP is easier and more powerful than the other
    two methods.
  • A Web service client formats a SOAP request
    packet
  • The client sends the SOAP request to the XML Web
    service via an HTTP POST operation.
  • The XML Web service parses the request, create
    the object, call the method with the specified
    parameters, and return a SOAP response to the Web
    service client.

42
Calling a Web Service via SOAP
  • A client-side SOAP proxy class makes client
    applications much easier to write
  • The .NET Framework SDK provides wsdl.exe to
    generate proxy class from the WSDL file for
    accessing the methods in the specified language.
  • Visual Studio .NET uses the proxy class generator
    internally.
  • Create a Windows Forms project
  • Add the XML Web service page as a Web Reference
    to the project. This will run wsdl.exe internally
    and ask for a SOAP-based proxy in the language of
    the project.
  • Visual Studio then displays the namespace of the
    proxy class in Solution Explorer.
  • To access the XML Web service from the client,
    simply create an object of the proxy class and
    call the desired method on it.

43
Web Service Discovery
  • This is the aspect of making the presence and
    capabilities of a Web Service known to the world.
  • This is the UDDI (Universal Discovery,
    Description, and Integration) business registry
    service.
  • Initiated by Ariba, IBM, and Microsoft.
    Supported by more than 130 companies.
  • Provides a standard place to register Web
    Services. Check out www.uddi.org.
  • UDDI is a specification built on SOAP/XML and
    defines a document format and protocol for
    searching and retrieving discovery documents -
    which in turn link to DISCO documents.
  • DISCO (Discovery of Web Services) is a Microsoft
    protocol for retrieving the contracts for Web
    Services (WDSL documents).

44
Calling a Web Service via HTTP Get
  • By requesting a Web Service URL from the IE
    Address field, ASP.NET will respond with a
    neatly-formatted page that describes the Web
    Service and its methods. This page even
    provides a simple means to run the methods.
  • This is not UDDI or DISCO. Just a
    nicely-formatted page built from the metadata.
  • You can get the WSDL by appending ?wsdl to the
    URL.
  • To call a method, append the method name and
    parameters to the URL like this
  • /MethodName?ParmValueNextParmNextValue
  • e.g. http//localhost/timeservice/TimeServiceVB.as
    mx/GetTime?ShowSecondsFALSE
  • Calling the service in this manner will result in
    a simple XML response containing the return value.

45
Calling a Web Service via HTTP Post
  • The WSDL describes the requirements for doing
    this.
  • The Web Service expects that the incoming
    parameter values be contained in FORM fields with
    specific names. Therefore, the FORM has to
    contain INPUT elements named according to the
    WSDL. The ACTION attribute names the method
  • ltFORM MethodPost ActionTimeServiceVB.asmx/Get
    Timegt
  • The response is an XML string.

46
  • Visual studio.NET

47
Visual Studio .NET
  • Increased programming productivity
  • Easier to write code drag and drop Web App and
    Services Development.
  • Fully supports the .NET Framework
  • Simplified development
  • Multi-language support
  • Improved debugging
  • Unified IDE
  • Powerful design tools
  • Windows Forms, Web Forms
  • XML and component designers
  • Consistent set of tools across languages

48
Visual Studio.NET
  • Integrated Development Environment
  • Visual Basic.NET
  • Many language enhancements
  • Inheritance,Overloading, Free Threading
  • Visual C
  • Integration with .NET Framework with managed
    extensions (classes)
  • C
  • New development language
  • Based on C/C with Garbage Collection/Memory
    Management
  • JUMP (Java User Migration Path) to .NET (1/25/01)
  • Visual J has been removed from the Visual
    Studio suite.

49
VS.NET Features
  • Single IDE for all Languages
  • Server Explorer
  • Event Viewer, Message Queues, Services
  • SQL Databases, Data Connection, Etc.
  • Integrated IE Browser
  • HTML/XML Editors
  • Macros/Macro Explorer
  • Solution Explorer
  • Tabbed Documents
  • Dynamic Help
  • Common Forms Editor
  • VB.NET, C, and C

50
Reference
  • 1.http//www.microsoft.com
  • 2.http//www.15seconds.com
  • 3.http//asp.net
  • 4.http//ado.net
Write a Comment
User Comments (0)
About PowerShow.com