ASP .NET - SoC Project and Development server

wrackbaaMobile - Wireless

Dec 10, 2013 (3 years and 10 months ago)

75 views

1

.NET

With Thanks to Mark Campbell

…and Bill Gates

2



.NET




.
NET Components




.NET Framework Class Library




ADO.NET




ASP.NET





.NET
Remoting




Web Services




.NET compared to J2EE


Today

The .NET Platform

.NET at this level is not
technical


it is Branding


.NET Clients


.NET Foundation Services


.NET Enterprise Servers


.NET Framework

The .NET Platform: .NET Clients

.NET Framework Platforms


.NET Framework


Windows


Tablet PC


.NET Framework CE


Pocket PC


Derivatives:

»
Cell Phones

»
Set Top Boxes

»
Industrial Automation

The .NET Platform: Foundation Services


.NET My Services (Hailstorm)


.NET Passport


.NET Alerts


.NET Calendar, Contacts, In Box


.NET Presence, .NET Locations


.NET Application Settings


.NET Devices





Web Services Based

The .NET Platform: Enterprise Servers

The .NET Platform: .NET Framework

The .NET Framework:


A new platform for windows
software development



For Smart Windows Clients



For Thin Browser Clients



For Middle Tier Components



For Web Services



…and eventually for Databases

.NET Development Framework

Operating System

Common Language Runtime

Base Class Library

ADO.NET and XML

ASP.NET

Web Forms Web Services

Mobile Internet Toolkit

Windows

Forms

Common Language Specification

VB

C++

C#

J#



Common Type System (CTS)


Supplies all the supported languages with a
uniform rich set of types



Strictly enforces type safety



Ensures that classes are compatible with each
other by describing them in a common way



Enables types in one language to interoperate with
types in another language


Common Language Specification


CLS is the common language infrastructure used
in .NET



Specification that a language must conform to, to
be accepted into the .NET framework



The specification are detailed at
http://msdn.microsoft.com/net/ecma/

C# and .NET


A
copy

of Java with some bits


One of the original languages on .NET


is dependent on the .NET base class library


is not needed to use .NET



I think its what MS uses itself for new devt

CLR
-

Execution model

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

What is Managed Code?


Code that targets the .NET CLR


C#, Visual Basic .NET, Visual C++ .NET


30 or so other languages.



Provides “metadata” for security,
exceptions, debugging



Can access “Managed data” (garbage
collected) and regular old unmanaged data


Assemblies


Managed code compiles to an assembly



Component of a .NET application



Collection of functionality


Code module (DLL file)


Application (EXE file)



Assembly contains MSIL



Analogous to a Java .class file


Byte code, CPU independent



Compiled at runtime by the CLR


not interpreted


Common Language Runtime (CLR)


Analogous to the Java Virtual Machine



Converts MSIL code to machine code at runtime



Interacts only with MSIL so original source code
may be written in any .NET language

Class Loader

MSIL to Native

Compilers (JIT)

Code

Manager

Garbage

Collector (GC)

Security Engine

Debug Engine

Type Checker

Exception Manager

Thread Support

COM Marshaler

Base Class Library Support

Common Language Runtime (CLR)

.NET Framework Class Library


Rich set of libraries analogous to the Java API



Full documentation at
msdn.microsoft.com



Collection of classes



Provides common type system


Accessible from any “.NET language”



Classes contained in “namespaces”



Windows Apps:


System.Windows.Forms


XML:


System.XML


Database Stuff:


System.Data

System

System.Data (ADO .NET)

System.XML

System.Web (ASP .NET)

Diagnostics

Configuration

Collections

Net

IO

Threading

Text

Security

Common

OLEDB

SQLTypes

SQLClient

XPath

XSL

Runtime

InteropServices

Remoting

Serialization

Serialization

Configuration

SessionState

Caching


Security

Services

Description

Discovery

Protocols

UI

HTMLControls

WebControls

System.Drawing

Imaging

Drawing2D


Text

Printing

System.Windows.Forms

Design



ComponentModel

Schema

Reflection

Resources

Globalization

ServiceProcess

.NET Framework Class Library

Database Access in .NET


In .NET there is ADO.NET


“snapshots”

Data Source

DataSetCommand

Command

Connection

DataReader

DataSet

Client

Managed Provider

ADO.NET


ADO.NET is XML based


DataSet dynamically builds an XML schema inside to
store the data


Relational data and XML data can be handled in a
similar way!!



ADO.NET works
offline

once the data is fetched


Updating is partly automatic using DataSets



Currently there are two Managed Providers:


SQL Server


ADO

ADO.NET v JDBC


Similarities:


Decoupling of the concrete data model and the user
(using DataSets and ResultSets)



Differences:


ADO.NET uses XML extensively, JDBC has a more
relational flavor



JDBC is connection oriented, ADO.NET always works
non
-
connected, or offline



.NET DataSets are a kind of In
-
Memory
-
DB
-
Cache.


What is ASP.NET?


Replaced ASP for writing dynamic web pages,
based on services of CLR.



Any language supported by .NET can now be used
in ASP .NET pages



.aspx files (renamed .asmx files) are no longer
interpreted but are compiled as MSIL code when
invoked



ASP’s then run from the intermediate code
produced



Requires: IIS, .NET SDK

ASP.NET
-

(Server
-
Side Scripting)

ASP.NET Architecture:



IIS 5
Web
Server
Client
(1) get a.apx
(2) process
.NET
Engine
.NET
Assembly
Other
Assemblies
Database
(3) result
(4) HTTP file
IIS 5
Web
Server
Client
(1) get a.apx
(2) process
.NET
Engine
.NET
Assembly
Other
Assemblies
Database
(3) result
(4) HTTP file
24

ASP.NET


[HTML + tags + (VB or C#)]


HTML



DELL.com


(largest world computer retailer?)



DABS.com


(largest uk computer part retailer?)

25

Visual Studio v Express (Free)


Studio





Built
-
in webserver (mini IIS)



Code behind


v

code inline




26

Toolset


DB


MSAccess


ASP.NET ( VB or C# )


Visual Studio


Hosting (Dev v Live)

27

Dynamic DB Based Page


Data in database table


Connect to database


(“attach” db to page)


Open


Retrieve


Loop


Display


Close


Mix with HTML (special language tags)

28

Browser
-

Display

29

Browser Insert

textbox

button

hyperlink

Form

Table

30

<html>

<form

runat="server">


<wmx:
AccessDataSourceControl



id="AccessDataSourceControl1" runat="server"




ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;



Data Source=mydatabase.mdb"


SelectCommand="SELECT * FROM contacts">


</wmx:
AccessDataSourceControl
>




<wmx:
MxDataGrid

id="MxDataGrid1" runat="server"



DataKeyField="Name" DataMember="contacts"


DataSourceControlID="AccessDataSourceControl1">


</wmx:
MxDataGrid
>

</form>

</html>

Display

out.asp
x

31

<form runat="server">


Name
: <asp:TextBox id="
TextBox1
"




runat="server"></asp:TextBox>




Telephone
: <asp:TextBox id="
TextBox2
"



runat="server"></asp:TextBox>




Email
: <asp:TextBox id="
TextBox3
"




runat="server"></asp:TextBox>




<asp:Button id="Button1"





onclick
="
Button1_Click
" runat="server"



Text="Insert"></asp:Button>

</form>

input

in.aspx

HTML

32

Sub
Button1_Click
(sender As Object, e As EventArgs)


MyInsertMethod

(textbox1.text, textbox2.text, textbox3.text)

End Sub

Function
MyInsertMethod
( name As String, telephone As String, email As String)



Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=mydatabase.mdb"


Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)


Dim queryString As String = "INSERT INTO contacts (Name, Telephone, Email) VALUES (@Name, @Telephone, @Email)"


Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand



dbCommand.CommandText = queryString


dbCommand.Connection = dbConnection




SETUP 3 PARAMETERS




dbConnection.Open


dbCommand.ExecuteNonQuery


dbConnection.Close



End Function

input

in.aspx

VB

Called by html

33

Installing Express


.NET framework 4?



MSAccess or SQL Server




Similarities:


Pages are precompiled to accelerate access


Similar syntax and concepts


ASP.NET provides „GUI components“ using
Webcontrols, Java provides Taglibs.



Differences:


All .NET languages can be used for ASP.NET scripting


Servlets/JSP are available for a wide range of
webservers


Many open source implementations, frameworks and
tools for Java

ASP.NET v JSP/Servlets


provides pluggable transports and formatters


currently TCP and HTTP transport and


binary and SOAP formatters



Contexts are automatically propagated



Only very simple lifecycle management options
for servants (compared to EJB or CORBA)


Singleton (one object for all calls)


SingleCall (new instance for each call)


Client
-
Activated based on leases

WCF (
Revise
)

Web Services in .NET

.NET provides a very easy and well
-
integrated way to
build Web Services:

namespace WebService1 {


public class Service1 : System.Web.Services.WebService {



// lot of stuff omitted



[WebMethod]



public double DM_to_Euro(double value) {




return value / 1.95583;



}





[WebMethod]



public double Euro_to_DM(double value) {




return

value * 1.95583;



}


}

}


Using Web Services in .NET is also simple


Some steps have been ommitted!




Webservices are “just a special way of remoting“



BUT:


Microsoft does not provide ebXML compliance


Currently they can only be used with a MS server

localhost.Service1 s1 = new localhost.Service1();

double result = s1.Euro_to_DM(200);

Web Services in .NET (
Revise
)


Similarities:


Both.NET and Java try to be standards
-
compliant
(SOAP, WSDL, UDDI).


Handling very similar: WSDL based generators that
create proxies



Differences:


For Java there are different solutions, whereas .NET
provides only one, natively. However, Web Services
are an intrinsic part of .NET (built in from the start!).


Currently, standards are interpreted differently, so
Interop Java
-
.NET is only limited. But this will
hopefully change!!


Web Services
-

.NET v J2EE

39


.NET or J2EE?


Gartner says:

neither is
“better”

The .NET Architecture

ASP.NET

COM+

Desktop

Clients

Presentation Tier

Business Tier

ADO.NET

.NET Remoting, MSMQ

or SOAP

.NET Enterprise

Server

.NET Building

Block Services

UDDI

Database

J2EE Architecture

Servlets

Java Server Pages

EJB

or BO

Presentation Tier

Business Tier

JDBC

(RMI / IIOP) if EJB

Database

Swing Desktop Clients

Other (eg Mobile) Clients

Data Tier

VB

C++

C#



Java Programming Language




Visual Studio.NET



Common Language Specification/

Intermediate Language

ASP.NET

Web Forms Web Services

Mobile Internet Toolkit


Windows

Forms


ADO.NET and XML

Base Class Library



Swing



Java Foundation Class (JFC)

JDBC / XML SAX & DOM Parser


JDK, BlueJ, JDeveloper,
JBuilder, WebSphere Studio,
Forte, Visual Café, etc.



Java Byte Code




Java Servlet

JSP / JavaBean


Common Language Runtime

Java Virtual Machine

Operating System

Mapping J2EE to .NET Framework

Comparison between .NET / J2EE

Open source solutions

Consistent


XML
-
Support

JSP/Servlets/Spring

ASP.NET (MVC)

Server Pages

Enterprise JavaBeans

COM+

Server Components

RMI/CORBA, JMS, Web
Services (standard
compliant)

.NET Remoting, MSMQ,
Web Services (no ebXML)

Communication middleware
(RPC, Messaging, Web)

Java
+ possibly others

C#
, VB, C++,....

Languages

Specification and many
implementations

Product Line

Status

Sun
/Oracle + JCP
-
Partner

Microsoft

Controller/Owner

J2EE

.NET

CORBA, JMS


COM/COM+ (COM
Interop)

InteropMiddleware

JCA

Host Integration Server

Legacy Integration

Swing

Windows.Forms Web.Forms

GUI
-
Libs

Java JVM

.NET CLR

Runtime

JNI

PInvoke

Interop (call
-
in/call
-
out)

Many classes on java.*

Many classes on System.*

Base libraries

JDBC / SQLJ and others

ADO.NET (ADO)

Database access

J2EE

.NET

Comparison between .NET / J2EE

45

From the trenches…


A personal view…


Microsoft has more productive tools


Less transparency (eg installation v Copy)


Philosophically never open source


Tie in to MS OS


Easier (IMO) for small/medium systems



Rates

(££) v Jobs (n) v Demand/Supply

46


MONO project


Chillisoft


Today’s workshop


mini tutorial


Trial versions available


http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java


City daily rates similar £550 per day (Java slightly higher?)