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 to VB using .Net by Wyatt and Oberg
What is .NET?
What is .NET? (according to some people)– Microsoft’s version of Java
What is .NET? (according to Microsoft)– Microsoft’s platform for XML Web services– Web Service = software component for the Web– People use web sites; Programs use Web Services
What is .NET? (for ACC students)– Software skills that are in demand
Languages and CLR
Compile to intermediate language (MSIL- Microsoft Intermediate Language)
MSIL is JIT (just in time) compiled to native code and run by the Common Language Runtime(CLR)
MSIL is designed to support different languages
.Net Languages
Microsoft ships several languages:– C# a new Java like language– VB.NET looks like VB– C++ managed extensions– J# Java syntax
3rd party– COBOL, FORTRAN, LISP
.NET Languages
C# Source
VBSource File
Other .NET Language
MSIL
Machine independent
Native Code
Machine Specific
Compile
JIT Compile
.NET Framework
C# VB.NET C++ Other
Visual Studio.Net
Common Language Specification
.Net Framework Class Library
Common Language Runtime
.NET Framework Overview
Common Language Runtime– Provides services to executing programs– Traditionally different environments have different
runtimes. (standard c library, VB runtime)– The CLR manages execution of code and provides
useful services– Services are exposed through the programming
languages– Syntax varies from language to language, but
underlying engine is the same– Not all languages expose all the features of the CLR– C# does the best job, but VB.NET does pretty well
.NET Framework Overview
.Net Framework Class Library– Huge, more than 2500 classes– All this functionality is built into the .NET
languages– 4 Main Parts
• Base class library (networking, I/O, diagnostics, etc.)• Data and XML classes• Windows UI• Web services and Web UI
.NET Framework Overview
Common Language Specification– Important goal of .NET is to support multiple
languages.– CLS is an agreement among language designers
and class library designers about what common subset of features can be relied upon
– Example – do not rely on case for uniqueness for names – because some languages are not case sensitive
.NET Framework Overview
Languages in .Net– Language is basically a lifestyle choice– Same built in data types are used in all the
languages – Classes written in one language can be
used in another language– A class written in one language can inherit
from a class written in another language
MSIL (Microsoft Intermediate Language)
All VB.Net code is compiled to MSIL– Machine independent– MSIL is JIT compiled to native code then executed
Metadata– Detailed info about each code module
• Version information• All the types• Details of each type• Details about properties and methods of each type
– MSIL and metadata are packaged together– Metadata enables ‘intellisense’ and enables types to be
converted transparently
Visual Studio.NET
Visual Studio is now one IDE for all the languages
When you start, you pick a profile (example, Visual Basic Developer Profile)
This arranges the windows and sets up the environment so it looks like VB
Most of the VB debugging tools are there (but, not the immediate window)
Some of the Changes to VB
All VB source files now have extension.vb No variant type Parentheses always required on all subroutine
calls Values returned from functions by using return
keyword
Function CalculatePay(ByVal payRate as Single, hrsWorked as Single) as Single
Dim grossPay as SinglegrossPay = hrsWorked * payRateReturn grossPay
End Function
Some of the Changes to VB
Passing byVal is now the default Lower bound of arrays is always 0 Exception handling
Try
code that might cause error
Catch e as Exception
code to handle error
End Try
Some Changes to OOP in VB.NET Objects and classes are more central to .Net
programming .Net makes vb into a real OO language .Net adds Inheritance to VB Shared Members
– A value or procedure associated with all instances of a class
Set is not needed for instantiation– myAcct = New BankAccount()
Some Changes to OOP in VB.NET Syntax for Properties is different
Private m_Name as String
Public Property Name() as String
Get
Return m_name
End Get
Set(ByVal Value a String)
m_name = Value
End Set
End Property
Some Changes to OOP in VB.NET Constructors
– Class_Initialize no longer exists– A class constructor called New
Public Sub New()
m_acctNo = 0
m_name = “”
m_balance = 0
End Sub
Database Access ADO.NET
Why ADO.NET?– Web applications have a more loosely
coupled structure– Many web apps use XML to encode data
that is passed over a network.– After the data has been extracted and
encoded, the connection can be closed– ADO.NET facilitates these kind of
disconnected scenarios
Database Access ADO.NET
DataSet object– Holds in memory a representation of data that was
retrieved– In XML– Can hold information from multiple tables– Also holds information about relationships and
constraints (an in memory database) Connection object used for connection oriented
applications DataAdapter object used for disconnected
applications
ADO.NET ArchitectureApplication
DataSet
.NET Data Provider(connection)
Database
XML Data
ConnectedAccess
Disconnected Access
Disconnected Access
Class ApplicationMSIL
Class DataSetMSIL
DOMData Set
XML
Table 2
Table 1
Internal Format
Table 1
Internal Format
Table 1
Internal Format
Table 3
Object Model of DataSetDataSet
Relationships Collection
Tables Collection
Relation Table
Constraints Collection
Primary Key
Columns Collection
Rows Collection
Constraint Data Column
Data Row