Sie sind auf Seite 1von 66

Introduction to .

NET

1 ER/CORP/CRS/LA31/003

Hello everybody! Welcome to this introductory session on .NET

1
Course Objectives

• Need for .NET framework

• To explain .NET development platform that supports web

services

• To explain .NET framework architecture

• Overview of Common Language Runtime

• To understand the role of CLR in source code

compilation & execution and the creation & structure of

the Assembly and metadata


2 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

The objective of this course is to help the DotNet user in understanding the need for the .NET
framework and to understand
1. the various building blocks of the .NET development platform which offer great support for
the Web Services paradigm
2. the constituents of the .NET framework architecture, mainly the Common Language
Runtime (CLR) and the Common Language Specification (CLS)
3. the process of source code compilation & execution, the creation & structure of the smallest
unit of deployment called Assembly and the role played by Metadata, which is compulsorily
built into the Assembly.
Also we’ll take a quick overview of the fundamental components of the .NET 3.0 platform –
1. The Windows Communication Foundation (WCF): a service-oriented messaging system
which allows programs to interoperate locally or remotely similar to web services.
2. The Windows Presentation Foundation (WPF): a new user interface subsystem and API
based on XML and vector graphics, which will make use of 3D computer graphics hardware
and Direct3D technologies
3. The Workflow Foundation (WF): allows for building of task automation and integrated
transactions using workflows.
4. The Windows CardSpace (previously called as InfoCard): a software component which
securely stores a person's digital identities and provides a unified interface for choosing the
identity for a particular transaction, such as logging in to a website.
5. Last but not the least, we’ll look at .NET’s implementation of the Unified programming
model in order to understand the order to understand the integration of different languages
based on the .NET platform.
*END*

2
Course Objectives Continued…

• To explain the fundamentals of WCF, WPF, WF and

Windows CardSpace

• To explain the Unified programming model of .NET

• To understand the integration of different languages

based on .NET framework.

3 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

The objective of this course is to help the DotNet user in understanding the need for the .NET
framework and to understand
1. the various building blocks of the .NET development platform which offer great support for
the Web Services paradigm
2. the constituents of the .NET framework architecture, mainly the Common Language
Runtime (CLR) and the Common Language Specification (CLS)
3. the process of source code compilation & execution, the creation & structure of the smallest
unit of deployment called Assembly and the role played by Metadata, which is compulsorily
built into the Assembly.
Also we’ll take a quick overview of the fundamental components of the .NET 3.0 platform –
1. The Windows Communication Foundation (WCF): a service-oriented messaging system
which allows programs to interoperate locally or remotely similar to web services.
2. The Windows Presentation Foundation (WPF): a new user interface subsystem and API
based on XML and vector graphics, which will make use of 3D computer graphics hardware
and Direct3D technologies
3. The Workflow Foundation (WF): allows for building of task automation and integrated
transactions using workflows.
4. The Windows CardSpace (previously called as InfoCard): a software component which
securely stores a person's digital identities and provides a unified interface for choosing the
identity for a particular transaction, such as logging in to a website.
5. Last but not the least, we’ll look at .NET’s implementation of the Unified programming
model in order to understand the order to understand the integration of different languages
based on the .NET platform.
*END*

3
Browsing Era

Positives:
Global connectivity
Simplicity
Mainstream
Negatives:
“Read-only”
No user control
Too many islands
Keyboard only
4 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

The evolution of technology– right from the terminal mainframe era through
the Character PC era and the rich GUI-based applications to the current
Internet Browsing era - has brought in major enhancements along with some
negatives as listed on the slide.
•The era of browsing the Internet wasn’t all bad. It was simple, easy to
understand, and offered a sense of global connectivity. But it required a
keyboard, created too many islands of information, and gave the user very
little control.
*END*

4
Technology Drivers
• Computing power
– Still doubling every 18 months
– PC-based data centers
• Connectivity
– Low cost, broad reach Internet and Wireless, broadband access
• Device proliferation
– Multiple devices - PDAs, Mobile phones, laptops
• Internet Standards
– XML-Based integration
• Single Tier ->Client/Server -> Windows DNA -> .NET

5 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•The constant evolution of technology and standards, is enabled with every day increase in
computing power and connectivity, through various devices on the one hand, and low and
affordable prices on the other.
•Most important is the evolution of eXtensible Markup Language (XML) as the internet standard for
information exchange, that has made tremendous impact on application integration.
•When automation first hit business, it was in the form of a huge "Mainframe" computer in the
Single-Tier model. Here, a central computer served the whole business community and was
accessed via dumb terminals.
•In the 1980s, a revolution happened in the world of business computing when the Personal
Computer hit the streets. In order to provide personal software which ran on personal computers,
a model needed to be found where the enterprise could still share data. This became known as
the client/server model. The client (on the personal computer) would connect to a central computer
(server) and request data.
•We've shoe-horned applications into architectures instead of architecting solutions in order to
provide perfect fit. Why? Because solutions involving any degree of distribution were difficult to
implement cost-effectively - that is until the tools necessary to provide the choice of using Web
Services, Enterprise Serviced Components, and HTTP or TCP/IP Remoting was made available
by Microsoft’s Windows DNA (D istributed InterN et A rchitecture) that is an umbrella term for
Microsoft's enterprise network architecture built into Windows 2000. It includes all the components
that collectively provide a Web-enabled infrastructure for an organization, like Web Server, ASP
technology, COM Objects, MTS and MSMQ and AppCenter Server. The DNA moniker was coined
in 1997 for Windows NT. The term is not often used except when Microsoft products are
contrasted to the later .NET framework, in which case DNA means "prior to .NET."
*CONT.*

5
• This slide is intentionally left blank for notes continued
from previous page

6 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Windows DNA applications can be extended to become Web services, which can
then be integrated and orchestrated with other Web services using the .NET
platform. This idea of exposing certain functionality of an application, to the outside
world in the form of a Web Service, is much more enabled using the .NET platform
and the development, deployment and management of these new applications and
services will be greatly simplified by new .NET tools and technologies delivered by
Microsoft.
*END*

6
Need for .NET framework

• Problems with integration of application developed with


multiple technologies

• Limited cross-language interoperability

• COM technology drawbacks


– COM components registration, unloading
– Dynamic Link Library (DLL) Hell

• Hence Microsoft .NET Framework – a computing


platform for developing distributed applications for the
Internet.

7 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

So what were the major issues that caused Microsoft to come out with the new .NET framework after
Windows DNA?
• Problems crop up during the integration of a single application’s subsystems that have been
developed with multiple technologies. For example, a manufacturing organization would have different
systems, such as an inventory management system, a bill of material systems, and a general ledger
system, all implemented using various technologies available for application development. These
systems need to be integrated to form a higher-level enterprise information system for an organization.
To do so, application developers had to use technologies such as Microsoft Distributed Component
Object Model (DCOM), Common Object Request Broker Architecture (CORBA), Java Remote Method
Invocation (RMI), and so on. However, these distributed technologies are very tightly coupled to the
programming languages in which these applications have been developed
• Cross-language interoperability is also limited. For example, if classes had been developed in Visual
C++, it was not possible to develop new classes in Visual Basic that extended from those developed in
Visual C++. Therefore, developers would have to rewrite the same logic for the classes in all the
languages that were supported in their organization. Functional reusability was supported, but true
code reusability was not available in earlier technologies; therefore, a developer was forced to learn all
languages that were being used for application development in the organization.
• Registration of COM components. COM components had to be registered on the target machine
before they could be used by the application. The application had to look up the Windows registry to
locate and load the COM components.
• Unloading COM components. COM objects also required a special logic for freeing up the objects from
memory. This method is known as reference counting of COM objects. It is used to keep track of the
number of active references. When an object's reference count reaches zero, the object is removed
from memory. The major problem that arises out of this situation is that of circular reference. If circular
references exist between two COM components, they would not be freed from memory.
*CONT.*

7
This slide is intentionally left blank for the notes continued
from the previous slide

8 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Dynamic link library (DLL) hell. Whenever applications that use COM components
were installed on a machine, the installation process would update the registry with
the COM components information. Thus, there was a chance that these DLLs would
be overwritten when some other applications were installed on the same computer.
Therefore, an application that had been referring to one particular DLL would refer
to the wrong DLL. This caused a major problem when an application was referring
to particular version of a DLL.
*END*

8
.NET Design Goals

• Simplify application development


– More power, less plumbing

• Easier to deploy, run & maintain


– For components, versioning, availability

• Unify programming models & provide a consistent OOP


model
– Across many languages and application types

9 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

The .NET framework was designed with the following goals in mind –
1. To simplify the process of application development, deployment, execution and
maintenance.
2. To provide a common programming model such that components written in one
language can be used & extended by components written in other .NET-
compatible languages.
3. To provide a high level of code access security that enables administrators and
developers to authorize applications similar to the way they have always been
able to authorize users.
4. To use web standards & best practices of XML and standard protocols like
SOAP, HTTP, etc to ensure the maximum acceptability of the applications
developed.
*END*

9
.NET Design Goals Continued…

• Provide high-level code security


– Code access security, managed code execution in a secure runtime
environment and strong type checking

• Utilize web standards and best practices


– Rich XML, standard protocols like SOAP, HTTP

10 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

The .NET framework was designed with the following goals in mind –
1. To simplify the process of application development, deployment, execution and
maintenance.
2. To provide a common programming model such that components written in one
language can be used & extended by components written in other .NET-
compatible languages.
3. To provide a high level of code access security that enables administrators and
developers to authorize applications similar to the way they have always been
able to authorize users.
4. To use web standards & best practices of XML and standard protocols like
SOAP, HTTP, etc to ensure the maximum acceptability of the applications
developed.
*END*

10
.NET Platform

11 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

11
The .NET Platform
Building blocks

12 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•This slide gives a bird’s-eye view of the building blocks of the .NET platform.
•As seen in the figure, Microsoft .NET Framework is a computing platform that is a layer above the
Operating System and is used for developing distributed applications for the Internet and supports
many types of web services –
•External Web Services enable different organizations to exchange services over the
Internet
•Internal Web Services are owned by the organization that uses them .
•The .NET foundation services are a set of XML Web services like Passport (for user
identification) and services for user-preference management, calendar management, etc
that are used to move control of user data between various applications and users.
•The server infrastructure for .NET Framework, including Windows and the .NET Enterprise
Servers, is a suite of infrastructure applications for building, deploying and operating XML Web
services. Some of these servers are –
•BizTalk Server to create and manage XML-based business process orchestration across
applications and services
•SQL Server to store and retrieve structured XML data
•SharePoint™ Portal Server that acts as a default intranet portal and collaboration tool
•Exchange Server for email messaging and collaboration software
•Visual Studio .NET is a new rapid application development (RAD) tool that is common to all the
Microsoft programming languages in the .NET Framework.
•A .NET component is a pre-compiled class module with a .DLL extension. At run-time, it is
invoked and loaded into memory to be used by some consumer application.
Thus, the .NET platform allows the creation of both web and windows applications along with the
ability to expose required functionality of an application in the form of web services, to the outside
world.
*END*
12
.NET Platform – In Depth
Web Services
•Enables software
as a service
•Based on XML
•SOAP is a W3C
standard.

•Strong third party


support

•IBM, Ariba,
Commerce One,
Web Services
Iona, Rogue Wave
XML, SOAP, HTTP, HTML

13 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•The common Internet standards of XML, SOAP, HTTP and HTML form the basic building
block to provide web services.
•In fact, SOAP (Simple Object Access Protocol) is an open standard with strong third party
support from major Industry vendors.
•Web Services makes use of these open standards rather than any proprietary standards for
information exchange
*END*

13
.NET Platform – In Depth
.NET Framework

•Foundation for
building, deploying,
and running Web
Services
•Productive,
extensible, multi-
.NET Framework language
•Integration through
Web Services public Internet
XML, SOAP, HTTP, HTML standards
14 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

•.NET framework is freely downloadable from Microsoft.


•.NET is Language-agnostic meaning one can develop a project with
different modules coded in different .NET languages such as VB.NET, C#,
C++.NET or even Cobol.NET to name a few. The integration is seamless
across these modules which would be explained in later slides
•You can create your own language and compile as per Common Types
System specification to generate MSIL (Microsoft Intermediate Language)
and your language would be .NET enabled. Hence .NET framework is
extensible.
*END*

14
.NET Platform – In Depth
Visual Studio.NET

•Most productive
tool for developing
Visual Studio.NET
Web Services,
applications
•Unified
.NET Framework programming
model, IDE
Web Services •Builds on today’s
XML, SOAP, HTTP, HTML capabilities
15 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

Microsoft Visual Studio is Microsoft’s main software development product for


developers. It focuses on an integrated development environment which
lets programmers create standalone applications, web sites, web
applications, and web services that run on any platforms supported by
Microsoft's .NET Framework including Microsoft Windows servers and
workstations, PocketPC, Smartphones, and World Wide Web browsers
Visual Studio includes the following:
1. Visual Basic
2. Visual C++
3. Visual C#
4. Visual J#
5. Visual Web Developer
*END*

15
.NET Platform – In Depth
The final picture .NET languages
Microsoft .NET  ADA
Development Platform
 APL
Customers, Partners  COBOL
Delivering Web Services
 Pascal
3rd Party
Visual Studio.NET
Languages and Tools  Eiffel
3rd Party  Visual Perl
.NET Framework
Infrastructure
 Visual Python
Web Services  Smalltalk
XML, SOAP, HTTP, HTML
 and many more

16 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•As seen here, the .NET development platform can have 3rd party
infrastructure or languages or IDE tools with the end goal of delivering web
services or applications.
•This is a win-win situation where in the end users consuming the web
services or applications would be benefited the most.
*END*

16
Enterprise Servers
• Application Center Server
– Load balancing, clustering, replication and central management of multiple
IIS Web servers.
• Commerce Server
– A merchant server with shopping cart and credit card capabilities.
• Internet Security and Acceleration (ISA) Server
– A firewall, Web caching and policy management server. Replaces Microsoft
Proxy Server.
• Exchange Server
– An e-mail messaging and collaboration server.

17 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

This slide lists the family of server products from Microsoft that support the .NET
Framework and provide back office services, called Enterprise Servers.
*END*

17
Enterprise Servers Continued…
• Mobile Information Server
– An extension to Exchange Server for mobile users.
• BizTalk Server
– An integration server based on XML.
• SQL Server
– Microsoft's database management system (DBMS).

18 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

This slide lists the family of server products from Microsoft that support the .NET
Framework and provide back office services, called Enterprise Servers.
*END*

18
The Web Services Revolution
The Paradigm for the Digital Economy

• Integration Is Intrinsic
– An industry initiative
– Based on cross-platform standards
– Data and services
• Software As A Service
– Operate locally or hosted
– Programmability
– Any place, any time, any device

19 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

So what is this Web Services initiative that is driven across by the Industry rather
than by a single company?
•Web Services is not any proprietary standard but is basically meant to address the
cross platform integration of applications serving data and services
•Web Services can be hosted on the internet or within an organization depending on
ones need.
•Using Web Service one can extend the application just like a function call. For
simplicity lets assume a fictitious service provider company, BCal provides basic
calculator feature such as addition, subtraction, multiplication and division as web
service. You can extend this application by calling the services of BCal for basic
features and give your own implementation for scientific calculator features such as
Sin, Tan, Cosine, Secant, Cotangent and inverse by writing code for these and
expose this as web service or as a simply web or windows application.
•These services can be accessed using any type of device, as the code we would
write will be only for the functionality. The .net framework has built-in intelligence to
identify the client and emit code acceptable by the client. For example, if the request
is made from a desktop, the output would be HTML pages and if accessed by cell
phone the output would be .wml file. There wouldn’t be a need to write any extra or
separate code for these two devices.
*END*

19
Web Services – An Example

www.microsoft.com

20 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Let us look at a scenario where Web Services are used – that of Supply
chain management
Supplier A supplies items A1, A2, A3
Supplier B supplies items B1, B2, B3
Supplier C supplies items C1, C2, C3
You are hosting a site that supplies all the above. You have tied up with
suppliers A, B and C for selling their products. A customer visits your site
and gets all items supplied by A, B and C giving an overall good and
delightful experience for the customer. If the same customer visits Supplier
A, s/he would get only products sold by customer A as long as supplier A
doesn’t have any tie up with supplier B and C.
This example illustrates a B2C case study while web services can be used in
a B2B Scenario also.
*END*

20
.NET Framework

21 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

21
The .NET Framework 3.0 Architecture

• Designed from the ground up for a web services


world
• XML natively supported
• Web services built in
• Secure mobile code
• Designed for high availability / reliability

22 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•The entire .NET framework 2.0 with native support for XML and web service
incorporates a lot of new additional features while there exists over it a layer of new
components like WPF, “InfoCard”, WCF and WF.
•The Microsoft Windows Presentation Foundation (formerly code named "Avalon")
provides the foundation for building applications and high fidelity experiences in
Longhorn, blending together application UI, documents, and media content, while
exploiting the full power of your computer.
•Windows CardSpace (formerly "InfoCard") is a Microsoft NET Framework 3.0
(formerly WinFX) component that provides the consistent user experience required
by the identity metasystem. It is specifically hardened against tampering and
spoofing to protect the end user's digital identities and maintain end-user control.
•Windows Communication Foundation (formerly code-named "Indigo") is a set of
.NET technologies for building and running connected systems. It is a new breed of
communications infrastructure built around the Web services architecture.
•Windows Workflow Foundation is the programming model, engine and tools for
quickly building workflow enabled applications on Windows. It consists of a
Microsoft NET Framework version 3.0 (formerly WinFX) namespace, an in-process
workflow engine, and designers for Visual Studio 2005.
*END*

22
The .NET Framework 3.0 Architecture

http://msdn2.microsoft.com/hi-in/netframework/aa663309.aspx

23 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•The entire .NET framework 2.0 with native support for XML and web service
incorporates a lot of new additional features while there exists over it a layer of new
components like WPF, “InfoCard”, WCF and WF.
•The Microsoft Windows Presentation Foundation (formerly code named "Avalon")
provides the foundation for building applications and high fidelity experiences in
Longhorn, blending together application UI, documents, and media content, while
exploiting the full power of your computer.
•Windows CardSpace (formerly "InfoCard") is a Microsoft NET Framework 3.0
(formerly WinFX) component that provides the consistent user experience required
by the identity metasystem. It is specifically hardened against tampering and
spoofing to protect the end user's digital identities and maintain end-user control.
•Windows Communication Foundation (formerly code-named "Indigo") is a set of
.NET technologies for building and running connected systems. It is a new breed of
communications infrastructure built around the Web services architecture.
•Windows Workflow Foundation is the programming model, engine and tools for
quickly building workflow enabled applications on Windows. It consists of a
Microsoft NET Framework version 3.0 (formerly WinFX) namespace, an in-process
workflow engine, and designers for Visual Studio 2005.
*END*

23
.NET Framework 2.0 Architecture

http://www.ies.aust.com/ten/ten19_files/image001.gif

24 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Currently dot net framework is available on Windows OS.


•Dot net framework for Unix is available in beta1.0 codenamed under the project
mono.
•CLR is the engine for dot net. CLR brings in a huge set of benefits such as
Seamless integration of code written in various dot net enabled languages,
Evidence-based security with code identity, Assembly-based deployment that
eliminates DLL Hell, Side-by-side versioning of reusable components, Code reuse
through implementation inheritance, Automatic object lifetime management etc.
•There are a huge set of rich base class library available to all dot net languages
•Data access is provided through ADO.Net, next version of ADO and all information
exchange happens through XML
•Two types of forms: ASP.NET forms for the Web Scenario and Windows forms for
rich Client Server application development
•ASP.NET is a great web application & service development platform
•Control-based pages, intuitive web services
•Fast, scalable, reliable, available
•Any language which can compile as per the CLS (common Language specification)
will be a dot net enabled language.
*END*

24
.NET Framework 2.0 Architecture
Common Language Runtime

http://www.ies.aust.com/ten/ten19_files/image001.gif

25 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Now let us look at the Common Language Runtime (CLR) in detail.


*END*

25
Common Language Runtime (CLR)

• Simplified Development
• Multi-Language Development
• Simplified Deployment
• Seamless Integration with COM objects
• Manages running code
– Verifies type safety
– Provides garbage collection, error handling
– Code access security for semi-trusted code

26 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

CLR is the main runtime engine for dot net. This is responsible for verifying type safety,
garbage collection and error handling along with Code Access Security.
•As mentioned earlier the development should be specific to implementing the
functionality needed rather than writing marshalling code or plumbing code etc.
•One project can have multiple modules implemented using different dot net languages
and the integration is seamless
•Assemblies provide a way for simplified deployment. No more registering of components
thereby removing the dependency on registry. The inherent disadvantage of not allowing
for simultaneous multiple versions of components is overcome in dot net. This problem is
referred to as dll hell. Making use of existing COM components without any issues will be
as simple as adding a reference and making use of this in the project.
•Code access security (CAS) is a new feature provided by the .NET Common Language
Runtime. CAS is the part of the .NET security model that determines whether or not a
piece of code is allowed to run, and what resources it can access when it is running.
Before .NET all applications were having complete access to all local resources on the
system based on the privileges granted to the id which had logged in. There was no way
of restricting the code from not accessing part of the privileges granted to the context in
which the code was being executed. Hence there is a serious threat whenever a code is
being downloaded and executed on the system.
*CONT.*

26
Common Language Runtime (CLR) Contd…

• Provides common type system


– Value types (integer, float, user defined, etc)
– Objects, Interfaces
• Provides access to system resources
– Native API, COM interop, etc.

27 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

CLR is the main runtime engine for dot net. This is responsible for verifying type safety,
garbage collection and error handling along with Code Access Security.
•As mentioned earlier the development should be specific to implementing the
functionality needed rather than writing marshalling code or plumbing code etc.
•One project can have multiple modules implemented using different dot net languages
and the integration is seamless
•Assemblies provide a way for simplified deployment. No more registering of components
thereby removing the dependency on registry. The inherent disadvantage of not allowing
for simultaneous multiple versions of components is overcome in dot net. This problem is
referred to as dll hell. Making use of existing COM components without any issues will be
as simple as adding a reference and making use of this in the project.
•Code access security (CAS) is a new feature provided by the .NET Common Language
Runtime. CAS is the part of the .NET security model that determines whether or not a
piece of code is allowed to run, and what resources it can access when it is running.
Before .NET all applications were having complete access to all local resources on the
system based on the privileges granted to the id which had logged in. There was no way
of restricting the code from not accessing part of the privileges granted to the context in
which the code was being executed. Hence there is a serious threat whenever a code is
being downloaded and executed on the system.
*CONT.*

27
This slide is intentionally left blank for the notes
continued from the previous slide

28 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•CLR implements Code Access Security based on the evidence for an Assembly.
Assemblies will be discussed in future slide. Evidence can be such as from which
site the code is being downloaded, any strong name key available or digital
signatures and assigns the code to a particular code group based on the evidence.
Each code group has a set of permissions which define what all the assembly can
access and perform.
•By default memory management is done by CLR and the garbage collection runs
as a low priority thread. The execution of this is non deterministic. This implies that
no more pointer access by default. Relinquishing of memory is done by the
garbage collection once the object are marked for garbage collection. However
Microsoft hasn’t removed the feature of pointers completely. One can use pointers
by writing unmanaged code using keyword unsafe.
•NET Framework applications will eventually replace those developed with COM.
Until then, you may need to use or create COM objects with Visual Studio.
Interoperability with COM, or COM interop, enables you to use existing COM
objects while transitioning to the .NET Framework at your own pace.
*END*

28
Common Language Runtime
Compilation & Execution

29 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

This slide illustrates the role of the CLR in execution of the assembly obtained after
the compilation of the source file (written in a .NET language).
All language compilers generate the same MSIL (Microsoft Intermediate Language)
code in the Assembly stored inside a .PE (Portable Executable) file. This contains
both code and metadata. The MSIL can be deployed to compile to native code
either before installation or the first time each method is called (Just In Time
compiler).
All code that is executed by the CLR ( or targetted to run by the CLR) is called
managed code. Any code that is executed directly on the Operating System is
called unmanaged code.
*END*

29
So what is an assembly?
•This is the basic deployment unit of any dotnet executable with an extension .dll or
.exe, which runs within CLR
•Assemblies are the building blocks used by the .NET Framework to solve the
versioning and deployment issues just described. Assemblies are the deployment
unit for types and resources. In many ways an assembly equates to a DLL in today's
world; in essence, assemblies are "logical DLLs.“
•Assemblies are self-describing through metadata called a manifest. Just as .NET
uses metadata to describe types, it also uses metadata to describe the assemblies
that contain the types.
•Assemblies are about much more than deployment. For example, versioning in
.NET is done at the assembly level—nothing smaller, like a module or a type, is
versioned. Also, assemblies are used to share code between applications. The
assembly that a type is contained in is part of the identity of the type.
•The code access security system uses assemblies at the core of its permissions
model. The author of an assembly records in the manifest the set of permissions
required to run the code, and the administrator grants permissions to code based on
the assembly in which the code is contained.
•Finally, assemblies are also core to the type system and the run-time system in that
they establish a visibility boundary for types and serve as a run-time scope for
resolving references to types.
[For more on assemblies, refer http://msdn2.microsoft.com/en-
gb/library/ms973843.aspx]
*END*

30
Metadata

• Language neutral type info and more


– Generated from source code (no IDL)
• Key to simpler programming model
– Common way to describe and use types
• Generated automatically by compilers
– Stored along with code in executable file
– binary format
• Required for execution (not optional)
• Convertible to/from XML Schema & COM type
libraries

31 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•A .NET language compiler will generate the metadata and store this in the
assembly containing the Common Intermediate Language (CIL). Metadata
describes all classes and class members that are defined in the assembly,
and the classes and class members that the current assembly will call from
another assembly. The metadata for a method contains the complete
description of the method, including the class (and the assembly that contains
the class), the return type and all of the method parameters. So when the
CLR executes CIL code, it will check to make sure that the metadata of the
called method is the same as the metadata that is stored in the calling
method. This ensures that a method can only be called with exactly the right
number of parameters and exactly the right parameter types.
•This is similar to the type library information of COM which is generated
during compilation. However, unlike type library information of COM, here
metadata is mandatory for execution.
*END*

31
What’s In The Metadata

• Description of deployment unit (assembly)

– Identity: name, version [,culture] [, public key]

– File list (hashing is used to verify version)

– What types & resources are exported

– What types are referenced (with version)

– Security permissions needed to run

32 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Metadata in an assembly may be viewed using the ILDASM tool provided by the
.NET Framework SDK.
*END*

32
.NET Framework Namespace

http://www.inf.pucminas.br/sblp2003/sblp2003_files/dotnet.pdf
33 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

The .NET Framework namespace is as shown above. All these & more
namespaces are to be found in the Base Class Library.
*END*

33
Features in .NET

• 64-Bit Platform Support

• Access Control List Support

• ADO.NET

• ASP.NET

• Authenticated Streams

• COM Interop Services Enhancements


34 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

•The new generation of 64-bit computers enables the creation of applications that can
run faster and take advantage of more memory than is available to 32-bit applications.
New support for 64-bit applications enables users to build managed code libraries or
easily use unmanaged code libraries on 64-bit computers.
•An access control list (ACL) is used to grant or revoke permission to access a
resource on a computer. New classes have been added to the .NET Framework that
allow managed code to create and modify an ACL. New members that use an ACL
have been added to the I/O, registry, and threading classes.
•New features in ADO.NET include support for user-defined types (UDT),
asynchronous database operations, XML data types, large value types, snapshot
isolation, and new attributes that allow applications to support multiple active result
sets (MARS) with SQL Server 2005.
•The Microsoft .NET Framework 2.0 includes significant enhancements to all areas of
ASP.NET –
•New controls to add commonly-used functionality to dynamic web
pages
•New data controls
•Improved code-behind model
•Caching features
•Customization of web sites and pages
•Support for a wide variety of browsers
•New authenticated stream classes like NegotiateStream and SslStream support
mutual authentication, data encryption, and data signing.
*CONT.*

34
This slide is intentionally left blank for the notes continued
from the previous slide

35 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Four major enhancements have been made to the classes and tools that support
interoperability with COM:
•The new SafeHandle and CriticalHandle classes, and their
specialized derived classes, provide safe and reliable means of
manipulating operating system handles.
•Two enhancements to the interop marshaler satisfy the two most
common user requests: the ability to wrap native function pointers into
delegates and the ability to marshal fixed-size arrays of structures
inside structures.
•The performance of calls between applications in different application
domains has been made much faster for common call types.
•New switches on the Type Library Importer (Tlbimp.exe) and Type
Library Exporter (Tlbexp.exe) eliminate dependency on the registry to
resolve type library references. This enhancement is important for
creating robust build environments.
*END*

35
Features in .NET … continued
• Console Class Additions
• Data Protection API
• Debugger features
• Network & I/O Enhancements
• Distributed computing
• Generics and Generic Collections
• .NET Framework Remoting
• Manifest-Based Activation
• Windows Forms–Related Features
• XML-Related Features

36 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•New members of the Console class enable applications to manipulate the dimensions of the
console window and screen buffer; to move a rectangular area of the screen buffer, which is
useful for performing smooth, simple animation; and to wait while reading console input until a
key is pressed.
•The new Data Protection API (DPAPI) includes four methods that allow applications to
encrypt passwords, keys, connections strings, and so on, without calling platform invoke.
•The debugger's Display Attributes feature enables you to identify the most useful information
to display in the debugger. The .NET Framework 2.0 reintroduces the Edit and Continue
feature that enables a user who is debugging an application in Visual Studio to make changes
to source code while executing in Break mode.
•The NetworkChange class provides address change notification by raising events when a
change is detected. Using classes in the System.Net.NetworkInformation namespace,
applications can access IP, IPv4, IPv6, TCP, and UDP network traffic statistics. The Ping
class allows an application to determine whether a remote computer is accessible over the
network. You can use the HttpListener class to create a simple Web server that responds to
HTTP requests. Improvements have been made to the usability and functionality of various
I/O classes. It is now easier for users to read and write text files and obtain information about
a drive.
•Language features collectively known as generics act as templates that allow classes,
structures, interfaces, methods, and delegates to be declared and defined with unspecified, or
generic type parameters instead of specific types. The new System.Collections.Generic
namespace provides support for strongly typed collections. System.Nullable<T> is a standard
representation of optional values. Generics are supported in three languages: Visual Basic,
C#, and C++. Reflection has been extended to allow runtime examination and manipulation of
generic types and methods.
*CONT.*

36
This slide is intentionally left blank for the notes continued
from the previous slide

37 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•.NET Framework remoting now supports IPv6 addresses and the exchange of generic types.
The classes in the System.Runtime.Remoting.Channels.Tcp namespace support authentication
and encryption using the Security Support Provider Interface (SSPI).
•Manifest-based activation is essential for supporting ClickOnce applications. Traditionally,
applications are activated through a reference to an assembly that contains the application's
entry point.
•Windows Forms-Related Features
•ClickOnce Deployment
•Application Settings
•New Data-Binding Model
•New Windows Forms Controls
•The .NET Framework 2.0 provides many enhancements, including a new XSL Transformation
(XSLT) processor; type support in the XmlReader, XmlWriter, and XPathNavigator classes; and
new editing capabilities in the XPathNavigator class.
*END*

37
Overview of
Windows CardSpace, WPF, WCF, WF

38 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

38
Four new technologies in .NET Framework 3.0
(formerly, WinFX)

• Windows CardSpace (formerly, Infocard)


– Technology to simplify and improve the safety
of accessing resources and sharing personal identity
information online.

• Windows Presentation Foundation (formerly, Avalon)


– Provides classes for building UI, documents, and
media

39 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

With Service-Orientation, we retain the benefits of self-describing applications, explicit


encapsulation, and dynamic loading of functionality. What changes is the metaphor with
which we accomplish it. Instead of using method invocation on an object reference, we
shift the conversation to that of message passing – a proven metaphor for scalable
distributed software integration. In addition, to support dynamic loading of service-
based functionality, we use schema to describes the structure of messages, behavioral
contract to define acceptable message exchange patterns, and policy to define service
semantics.
Next generation Windows’ Technology Foundation:
•Windows Communication Foundation (WCF)
•- Secure, reliable, transacted, interoperable application to application communications
•Windows Workflow Foundation (WWF)
•- Programming model, engine, and tools to build workflow-enabled applications that
model business processes
•Windows Presentation Foundation (WPF)
•- Vector-based, resolution independent, rich media, 3D user interface experiences
•Windows Cardspace
•- Streamlines user registration and one-click login, Mitigates common attack vectors
(Phishing), Seamless integration with WCF
Note: For Virtual labs provided by Microsoft on WinFX, refer
http://msdn.microsoft.com/virtuallabs/netframe/default.aspx
*END*

39
Four new technologies in .NET Framework 3.0
(formerly, WinFX)

• Windows Communication Foundation (formerly, Indigo)


– Unified programming model and runtime for
building service oriented applications

• Windows Workflow Foundation


– Programming model, engine, and tools to build
workflow-enabled applications that model business
processes

40 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

With Service-Orientation, we retain the benefits of self-describing applications, explicit


encapsulation, and dynamic loading of functionality. What changes is the metaphor with
which we accomplish it. Instead of using method invocation on an object reference, we
shift the conversation to that of message passing – a proven metaphor for scalable
distributed software integration. In addition, to support dynamic loading of service-
based functionality, we use schema to describes the structure of messages, behavioral
contract to define acceptable message exchange patterns, and policy to define service
semantics.
Next generation Windows’ Technology Foundation:
•Windows Communication Foundation (WCF)
•- Secure, reliable, transacted, interoperable application to application communications
•Windows Workflow Foundation (WWF)
•- Programming model, engine, and tools to build workflow-enabled applications that
model business processes
•Windows Presentation Foundation (WPF)
•- Vector-based, resolution independent, rich media, 3D user interface experiences
•Windows Cardspace
•- Streamlines user registration and one-click login, Mitigates common attack vectors
(Phishing), Seamless integration with WCF
Note: For Virtual labs provided by Microsoft on WinFX, refer
http://msdn.microsoft.com/virtuallabs/netframe/default.aspx
*END*

40
Windows CardSpace
• lets any Windows application give its users a common
way to work with digital identities
• Enables users to provide their digital identity to online
services in a simple, secure and trusted way.
• Available for Windows Vista, Windows XP, and Windows
Server 2003
• Different roles in the digital identity system
– User
– Identity Provider
– Relying Party

41 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Digital identities come in all shapes and sizes. An e-mail account with Yahoo - identified by an
e-mail address. Accounts in Various commercial organizations, such as Amazon or eBay –
identified by a username or at work - identified by your network login.
Every digital identity is associated with some information. When transmitted on the network,
every digital identity is represented by some kind of security token like username, X.509
certificates, and Kerberos tickets
Infocard contains information like what identity provider to contact to acquire a security token
for this identity, what kind of tokens this identity provider can issue, and exactly what claims
these tokens can contain. T he terms commonly used are –
1. User—Also known as the subject, the user is the entity that is associated with a digital
identity. Users
are often people, but organizations, applications, machines, and other things can also have
digital identities.
2. Identity provider—An identity provider is just what the name suggests: something that
provides a digital identity for a user. For the digital identity assigned to you by your
employer, for example, the identity provider is typically a system such as Active Directory.
For the digital identity you use with Amazon, the identity provider is effectively you, since
you define your own username and password.
3. Relying party—A relying party is an application that in some way relies on a digital identity.
A relying party will frequently use an identity (that is, the information contained in the claims
that make up this identity's security token) to authenticate a user, and then make an
authorization decision, such as allowing this user to access some information. A relying
party might also use the identity to get a credit card number, to verify that the same user is
accessing it at different times, or for other purposes. Typical examples of relying parties
include Internet websites such as online bookstore and auction sites, and any application
that accepts requests through Web services.
*CONT.*

41
Windows CardSpace Continued…
• A digital identity is represented by an InfoCard that the
user can present to a relying party
• An infocard along with visual representation contains
information about a particular digital identity
• CardSpace allows replacing password-based Web login
with a stronger mechanism.

42 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Digital identities come in all shapes and sizes. An e-mail account with Yahoo - identified by an
e-mail address. Accounts in Various commercial organizations, such as Amazon or eBay –
identified by a username or at work - identified by your network login.
Every digital identity is associated with some information. When transmitted on the network,
every digital identity is represented by some kind of security token like username, X.509
certificates, and Kerberos tickets
Infocard contains information like what identity provider to contact to acquire a security token
for this identity, what kind of tokens this identity provider can issue, and exactly what claims
these tokens can contain. T he terms commonly used are –
1. User—Also known as the subject, the user is the entity that is associated with a digital
identity. Users
are often people, but organizations, applications, machines, and other things can also have
digital identities.
2. Identity provider—An identity provider is just what the name suggests: something that
provides a digital identity for a user. For the digital identity assigned to you by your
employer, for example, the identity provider is typically a system such as Active Directory.
For the digital identity you use with Amazon, the identity provider is effectively you, since
you define your own username and password.
3. Relying party—A relying party is an application that in some way relies on a digital identity.
A relying party will frequently use an identity (that is, the information contained in the claims
that make up this identity's security token) to authenticate a user, and then make an
authorization decision, such as allowing this user to access some information. A relying
party might also use the identity to get a credit card number, to verify that the same user is
accessing it at different times, or for other purposes. Typical examples of relying parties
include Internet websites such as online bookstore and auction sites, and any application
that accepts requests through Web services.
*CONT.*

42
This slide is intentionally left blank for the notes continued
from the previous slide

43 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Replacing password-based Web login


•Password-based schemes where user chooses username & password for access
to sites, may use SSL for encrypted communication but still are vulnerable to a kind
of attack called phishing. By sending deceptive e-mail messages, attackers attempt
to trick users into logging in to spurious copies of real sites, revealing their
passwords and perhaps other personal information. If passwords weren't the
dominant authentication mechanism on the Web, however, this kind of phishing
would be less of a threat—there would be no passwords to steal.
•CardSpace allows replacing password-based Web login with a stronger
mechanism. Rather than authenticating users with passwords, a relying party such
as a website might instead authenticate users with security tokens. Where users
choose their own usernames and passwords, CardSpace includes a self-issued
identity provider.
*END*

43
How it works?

www.microsoft.com

44 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

So how is any digital identity system supported –


• First, the application gets the security token requirements of the relying party
that the user wishes to access. This information is contained in the relying
party's policy, and it includes things such as what security token formats the
relying party will accept, and exactly what claims those tokens must contain.
• Once it has the details of the security token this relying party requires, the
application passes this information to CardSpace, asking it to request a token
from an appropriate identity provider.
• Once this security token has been received, CardSpace gives it to the
application, which passes it on to the relying party. The relying party can then
use this token to authenticate the user or for some other purpose.
*END*

44
Windows Presentation Foundation
(formally known as “Avalon”)
A high percentage of classes in WPF inherit from the
following four "building block" classes:
– UIElement
– FrameworkElement
– ContentElement
– FrameworkContentElement
• A productive, unified approach to UI, Media, and
Documents that you can use to deliver unmatched user
experiences to your customers.
• The next-generation Windows smart-client UI technology
• Offers a sophisticated visual toolbox to create a great
user experience that scales to different form factors
• Works on Windows Vista, Windows XP and Windows
Server 2003

45 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

These four classes are typically referred to as the base element classes because they form
the basis of a common model for composing user interface (UI).
In WPF, a UI is composed of elements that are assembled in a tree hierarchy, which is
known as an element tree. The element tree provides a logical and intuitive way for you to
create user interfaces (UIs). It is also a structure over which you can layer more powerful UI
services.
One UI service is the dependency property system, which enables one element to implement
a property whose value is automatically shared with its child elements in the element tree.
For example, this property system enables the background color of a window to be
automatically applied to all child elements of windows that do not specify their own
background color.
Another service that takes advantage of the element tree is the routed event system. The
Microsoft .NET Framework version 3.0 provides direct events, which are only raised on one
element. Routed events, however, can traverse the element tree in a route between the root
element and the originator of the event; they can be handled by any element along the route.
One type of routed event bubbles up the tree from the originator, which gives all parent
elements the option of handling the event. Another type of routed event tunnels down to the
originator to provide an opportunity for all parent elements of the originator to preview the
event.
The main reason to handle events is to capture and process user input. The WPF input
system incorporates direct and routed events for this purpose. It also adds more support for
text input, focus management, and mouse positioning.
Just as the input system operates directly over input devices, the commanding system
provides a layer of abstraction that separates input actions from the code that responds to
those actions. The commanding system is modeled on the familiar command design pattern.
*CONT.*

45
Windows Presentation Foundation
(formally known as “Avalon”)
Declarative programming (XAML) for better designer-
developer collaboration
• Common code base and flexible deployment as stand-
alone client or in browser
• Interoperability with Windows Forms, Win32, DirectX,
MFC, ActiveX
• Increases Developer – Designer productivity

46 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

These four classes are typically referred to as the base element classes because they form
the basis of a common model for composing user interface (UI). For more information, see
Base Elements Overview.
In WPF, a UI is composed of elements that are assembled in a tree hierarchy, which is
known as an element tree. The element tree provides a logical and intuitive way for you to
create user interfaces (UIs). It is also a structure over which you can layer more powerful UI
services..
One UI service is the dependency property system, which enables one element to implement
a property whose value is automatically shared with its child elements in the element tree.
For example, this property system enables the background color of a window to be
automatically applied to all child elements of windows that do not specify their own
background color.
Another service that takes advantage of the element tree is the routed event system. The
Microsoft .NET Framework version 3.0 provides direct events, which are only raised on one
element. Routed events, however, can traverse the element tree in a route between the root
element and the originator of the event; they can be handled by any element along the route.
One type of routed event bubbles up the tree from the originator, which gives all parent
elements the option of handling the event. Another type of routed event tunnels down to the
originator to provide an opportunity for all parent elements of the originator to preview the
event.
The main reason to handle events is to capture and process user input. The WPF input
system incorporates direct and routed events for this purpose. It also adds more support for
text input, focus management, and mouse positioning.
Just as the input system operates directly over input devices, the commanding system
provides a layer of abstraction that separates input actions from the code that responds to
those actions. The commanding system is modeled on the familiar command design pattern.
*CONT.*

46
This slide is intentionally left blank for the notes continued
from the previous slide

47 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Increase Developer-Designer Productivity


•Visual Studio IDE for developers; Microsoft Expression for designers
•Declarative programming (XAML) for better designer-developer
collaboration
•Common code base and flexible deployment as stand-alone client or in
browser
•*END*

47
WPF

• Declarative Programming through XAML

XAML C# VB.NET
<Button Width="100"> OK Button b1 = new Button(); Dim b1 As New Button
<Button.Background> b1.Content = "OK"; b1.Content = "OK"
LightBlue b1.Background = new b1.Background = New _
</Button.Background> SolidColorBrush(Colors.LightBlue); SolidColorBrush(Colors.LightBlue)
</Button> b1.Width = 100; b1.Width = 100

www.microsoft.com

48 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

XAML - eXtensive Application Markup Language


• Is the format which integrates the development process and is the way for both developers and designers to access the
functionalities of WPF
• Can be rendered in the browser (as part of a web page) or as a standalone application
• Provides an XML-based way to specify declaratively a hierarchy of objects with properties and logic
• Code and content are separate
XAML
<Button Background=“LightBlue” Width=“100”> Okay </Button>
C#
Button b1 = new Button();
b1.Content = "Okay";
b1.Background = new SolidColorBrush(Colors.LightBlue);
b1.Width = 100;

Integrating markup and code


XAML File
<Canvas ID="root“ xmlns="http://schemas.microsoft.com/2006/xaml“>
<Button Click="Button_Click">Click Me!</Button>
</Canvas>

C# code-behind file
using…
namespace Button
{
public partial class Default : Panel
{ // Event handler
void Button_Click (object sender, System.Windows.Controls.ClickEventArgs e)
{ btn1.Background = System.Windows.Media.Brushes.Red; }

*END*

48
Windows Presentation Foundation / Everywhere
(WPF/E)

• Version of WPF for mobile devices and multi-platform


– Cross-platform, cross-browser web technology supporting subset of
WPF XAML
– Subset runtime of WPF that's small, fast and will run everywhere
– The goal: To work everywhere – Macs, FireFox, Phones, devices
• Subset of WPF feature set
• Lightweight download
• Programming model is XAML, but instead of procedures
like C#, we use JavaScript

49 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•WPF merges controls and graphics into one programming model


•Provides a “content model”
•Allows any control to host any group of other controls
•No special “BitmapButton” class, just stick things where you want
•To arrange content, WPF has containers to specify layout and flow
•To visualize content, WPF has data binding, styles, and animation
•Data binding syncs visual content on the fly
•Styles allow you to replace the complete look of a control while maintaining the
behavior
•Animation enables powerful visuals with no special coding
*END*

49
Overview of WCF
(formerly, called Indigo)

• A set of .NET technologies for building and running


connected systems.

• provides secure, reliable, and transacted messaging


along with interoperability for advanced Web services.

• unifies a broad array of distributed systems capabilities in


a composable and extensible architecture, spanning
transports, security systems, messaging patterns,
encodings, network topologies, and hosting models.

50 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Windows Communication Foundation


•introduces several ways for clients and servers to call remote methods.
•supports several serialization mechanisms and provides a simple, interoperable
foundation for future service-oriented applications
•provides three major protections— confidentiality, integrity, and authentication.
•control the construction of the Windows Communication Foundation channel stack
at runtime and what that channel stack is to begin with.
•does Instance management =>a set of techniques to bind a set of messages to a
service instance.
*END*

50
Windows Communication Foundation
A problem Example

http://msdn2.microsoft.com/en-us/library/ms731082.aspx

51 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Over its lifetime, a rental car reservation application will likely be accessed by a range of other
applications. When it is designed, however, the architects of the rental car reservation application
know that its business logic will be accessed, as shown in the figure, by three other kinds of
software:
A call center client application running on the Windows desktops that are used by employees in
the organization’s call center. Created specifically for the new reservations system, this
application will also be built using the Microsoft .NET Framework and WCF. This application is
not truly distinct from the new rental car reservation application, because its only purpose is to act
as a client for the new system. From a service-oriented perspective, it is just another client for the
reservation system’s business logic.
An existing reservation application built on a J2EE server running on a non-Windows system.
Due to a recent merger with another car rental firm, this existing system must be able to access
the new application’s logic to provide customers of the merged firms with a unified experience.
Partner applications running on a variety of platforms, each located within a company that has a
business arrangement with the car rental firm. Partners might include travel agencies, airlines,
and others that have a business requirement to make car rental reservations.

Diverse communication requirements for the new rental car reservation application:
•With the call center client application, higher performance & straightforward interoperability are
the goals
•With the existing J2EE-based reservation application and with the diverse partner applications,
interoperability becomes the highest goal
Different security & transactional requirements are to be met without exposing the creators of the
new application to unmanageable complexity.
*END*

51
Addressing the Problem

http://msdn2.microsoft.com/en-us/library/ms731082.aspx

52 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

In the absence of WCF, the development team that implements the rental car application
would need to choose the right distributed technology from the multiple choices offered by
the .NET Framework. Yet given the diverse requirements of this application, no single
technology would fit the requirements. Instead, the application would probably use multiple
existing .NET Framework technologies, such as the following:
1. ASMX (also called ASP.NET Web Services) along with Web Services
Enhancements (WSE) for more secure communication with J2EE-based applications,
2. .NET Remoting for tightly-coupled .NET-to-.NET communication ,
3. Enterprise Services to manage object lifetimes and distributed transactions,
4. Microsoft Message Queuing (MSMQ) to talk with Windows-based partner
applications
The rental car reservation application can, instead use a single technology – WCF for all of its
application-to-application communication. This is how WCF addresses each of these
requirements:
• Because WCF can communicate using Web services, interoperability with other platforms
that also support SOAP, such as the leading J2EE-based application servers, is
straightforward.
• WCF can also be configured and extended to communicate with Web services using
messages not based on SOAP, for example, simple XML formats like RSS.
• To allow optimal performance when both parties in a communication are built on WCF, the
wire encoding used in this case is an optimized binary version of an XML Information Set.
Messages still conform to the data structure of a SOAP message, but their encoding uses a
binary representation of that data structure rather than the standard angle-brackets-and-text
format of the XML 1.0 text encoding. Using this option makes sense for communicating with
the call center client application, because it is also built on WCF, and performance is an
important concern.
*CONT.*

52
This slide is intentionally left blank for the notes continued
from the previous slide

53 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Managing object lifetimes, defining distributed transactions, and other aspects of


Enterprise Services are now provided by WCF. They are available to any WCF-
based application, which means that the rental car reservation application can use
them with any of the other applications it communicates with.
•Because it supports a large set of the WS-* specifications, WCF helps provide
reliability, security, and transactions when communicating with any platform that
also supports these specifications.
•WCF’s option for queued messaging, built on Message Queuing, allows
applications to use persistent queuing without using another set of application
programming interfaces.
The result of this unification is greater functionality and significantly reduced
complexity.
WCF addresses a range of challenges for communicating applications. The most
important aspects are:
•Unification of existing .NET Framework communication technologies.
•Support for cross-vendor interoperability, including reliability, security, and
transactions.
•Explicit service orientation.
*END*

53
WCF Architecture

54 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

WCF Services expose a collection of Endpoints where each Endpoint is a portal for
communicating with the world. Each Endpoint has an Address, a Binding, and a Contract
(ABC). The Address is where the Endpoint resides, the Binding is how the Endpoint
communicates, and the Contract is what the Endpoint communicates.

•Here’s a high-level view of the WCF architecture. At the top is your code, the code you’re
developing in Visual Studio or your environment.
•The WCF service uses an address (like “http://localhost”), a binding that determines how
the service communicates, and a contract that specifies what operations the service can
carry out.
•The binding consists of modules that specify how the service communicates, such as
• which transport the service communicates on, whether http, tcp, etc
• what encoder the service uses, like a text/XML encoder, a binary encoder, or a
custom encoder
• what kind of security the service requires
• and any other communication requirements.
• When a message comes into the service, it is taken off the transport
• decoded with the proper decoder
• security is negotiated away
• and then the message is dispatched to the appropriate part of your code.
*END*

54
Windows Workflow Foundation

• Is the programming model, engine, and tools for


quickly building workflow-enabled applications on
Windows

• consists of a namespace called System.Workflow, an


in-process workflow engine, and designers for Visual
Studio 2005.

• can be developed and run on Windows Vista, Windows


XP, and the Windows Server 2003 family.

55 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•A workflow is a model of a human or system process which is defined as a map of


activities. An activity is a step in a workflow and is the unit of execution, re-use and
composition for a workflow. A workflow is designed by laying out activities and is
compiled to a .NET assembly that is executed on the workflow runtime and the
Common Language Runtime (CLR).
•WF provides full support for Visual Basic .NET and C#, debugging, a graphical
workflow designer, and developing your workflow completely in code or in markup.
•WF includes support for both system workflow and human workflow across a
variety of scenarios, including workflow within line-of-business applications, user
interface page-flow, document-centric workflow, human workflow, composite
workflow for service-oriented applications, business rule-driven workflow, and
workflow for systems management.
•also provides an extensible model and designer to build custom activities that
encapsulate workflow functionality for end users or for reuse across multiple
projects.
*END*

55
Windows Workflow Foundation

http://msdn2.microsoft.com/en-us/library/aa349006.aspx
56 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

The above illustration shows how workflows, activities, and the workflow runtime engine
are all hosted in process with a host application.

Workflow Models trace the path of activities for each identified business process from the
time the customer requests for a service (input) or when an output is required (for example,
"Create Garment"), through the participants, till the ultimate deliverables are produced.

The WF components are:


Activity—A unit of work performed by a participant. The work an activity implements can
range from very simple to quite complex.
Workflow—A group of activities that implements all or part of a business process.
Windows Workflow Foundation designers—Graphical tools that can be used to create and
modify workflows and activities.
Windows Workflow Foundation base activity library—A fundamental group of activities that
developers can use to create workflows.
Windows Workflow Foundation runtime engine—A library that executes workflows. The
runtime engine also provides other services, such as mechanisms for communicating with
software outside the workflow.
Host process—A Windows application that hosts the Windows Workflow Foundation
runtime engine and any workflows it executes. The host process provides supporting
runtime services for persisting a workflow's state, handling transactions, and other
functions.
*END*

56
.NET Framework in context

http://msdn2.microsoft.com/en-us/library/zw4w595w.aspx

57 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

The diagram shows three different scenarios for application development:


•Applications running managed code under the CLR, making use of the built-in
Base Class Library as well as other custom object libraries [‘Managed applications’
as seen in blue color in the left semi-circle ]
•Applications running unmanaged machine code directly on the Operating System
[‘Unmanaged applications’ as seen in lavender color in the right semicircle]
•Web applications and Web Services running managed code under ASP.NET
Runtime Engine inside IIS server[‘Managed Web applications’ as seen in blue color
in the top-left octant]
.NET Framework managed applications can co-exist with unmanaged applications
in the same computer. And depending on the programming language selected, you
can write both managed and unmanaged code to meet your requirements.
*END*

57
Advantages of .NET Framework

58 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

58
Simplify Deployment …

• No registration required
– Code is completely self-describing
– Simply copy components to app dir
• Zero-impact install
– Installing one app will not affect another
• Side-by-side execution
– Multiple component versions can co-exist
• Assemblies
– Contain dependency information

59 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•You don’t have to register your dot net component in the registry like earlier
components. This helps overcome the dll hell problem which didn’t allow two
simultaneous versions of the same component to be registered in the registry.
•All assemblies are private by default. So installing one application will not affect
another. If we need to share assemblies across different clients then we need to
deploy this into Global Assembly Cache (GAC). Microsoft has provided a tool
GACUTIL.exe for deploying into GAC. We need to sign the assembly with a strong
name before putting it into GAC. To generate strong name Microsoft has provided a
tool sn.exe. Use this strong name and deploy into GAC. You can have multiple
versions in GAC. Version information and key information is stored in the
AssemblyInfo file.
*END*

59
Simplify Development

• Completely eliminates COM plumbing


• No more… =>self described apps
– Registration =>hierarchical namespaces
– GUIDs =>unified object model
– .IDL files =>structured exceptions
– HRESULTs =>common root object
– IUnknown
=>garbage collector
– AddRef/Release
– CoCreateInstance =>”
=>”new”
new” operator

60 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

Development using the .NET framework is much more simple because


With the .NET Framework common language runtime, components are built on a
common substrate; No “plumbing” is needed and objects can directly interact
now that
1. Applications are self-described, so no need of separate registration
2. There are hierarchical namespaces, hence GUIDs not required at all
3. We have a unified object model, so creation of separate Interface Definition
Language files becomes unnecessary
4. We have structured exceptions, hence no need to use HRESULT type of values
to return error codes
5. We have a common root object, hence unnecessary to use IUnknown type to
indicate an unknown type of object
6. There is automatic garbage collection, hence no explicit call to AddRef / Release
required.
7. We have the new operator in the language; so usage of CoCreateInstance
function becomes unnecessary
*END*

60
How Much Simpler?

Windows API
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);

.NET Framework
Form form = new Form();
form.Text = "Main Window";
form.Show();

61 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•This is very similar to the VB forms one used to create.


•The Framework is not a “black box”
•Any .NET class is available for you to extend through inheritance
•Gives developers much more head room
•Plug and Play components and subsystems
*END*

61
A Unified Programming Model

http://www.inf.pucminas.br/sblp2003/sblp2003_files/dotnet.pdf

62 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•Microsoft has taken all good things from VB, ASP and MFC/ATL such as automatic
forms generation and easy component development as in VB, generation of
multithreaded, high performance component as in case of MFC/ATL COM and web
development using ASP and incorporated all the good things from these three into
.NET framework.
•Microsoft has incorporated libraries of classes into .NET framework. This is very
much needed. In case of up to VB6.0 there were no inbuilt classes. Developers
used to create classes and reuse this across projects but nothing was given as part
of IDE. This drawback has been addressed in .NET.
•All components created using any .net language has the same power as any other
.net language. There is no step mother treatment for components based on the
language being used to create the same.
*END*

62
Summary
XML Web services
.NET Language
•Expose functionality as
Web
Support Forms
service
•ASP.NET
The
•Common
Runtime
Familiar
No needdrag
to
Language
is language
and
learn drop
XML
neutral
Runtime
Server-
Server -side Web Forms and
Web •
Web development
Interface
Common Services is components
language automatically
Manages running code
specification
•ADO.NET Classes
generated
Separate
Separates
Framework
Fine-
code
Fine-grained
fromcode
UI and content
evidence-
evidence-
Microsoft is providing:
••
Compiled
Seamless
based deployment
security
XML
Build
Spans Web
data-
data
Visual services
-driven
all Basic,
programmingapplications
C++, C#,
No-
No -touch
No--touch
NoXML deployment
deploymentsystem

using
languages
Reuse
JScript™
JScript
consumption
Intelligent
™existing
state
Web
management
Object
Program
Services
Object-
Object remoting
against
-oriented and with
your objects
Third-
Third -parties are building:
SOAP
Controls
consistent sense client and
Easily pass data across
•APL,
VS.NET
adapt COBOL,
output: generates
HTML, thethe
Pascal,
DHTML,
wire
Commonand Haskell,
Eiffel, between platforms
type system
ML, built-
built-in
Oberon,
WML
plumbing
with XML
Perl, Python, Scheme,
Extensible

Relational
Smalltalk,andObjective
unstructured
Full IntelliSense
Secure
CAML,
support
data

•Build and consume with any
Inside the .NET Framework VS language

63 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•.NET Framework built for Web Services


•Simple, secure, modern, multi-language, object-oriented, XML built-in

•Comprehensive class libraries


•Consistent, comprehensive

•ASP.NET is a great web platform


•Control-based pages, intuitive web services
•Fast, scalable, reliable, available
•Since the MSIL is compiled code ASP.NET pages are much faster than ASP or JSP
•Highly scalable without any requirements for any special tool
•Garbage collection implemented in .Net framework thus relieving programmers from the house
keeping job of memory management

•Framework for rich Windows applications using Windows Forms


•Combines best of VB Forms, MFC and WFC
•Visual forms inheritance, automatic layout
•Advanced graphics support – GDI+
•Easy access to Win32 ® API
•Web Forms
•Familiar drag and drop Web development
•Separates UI and code
•XML Web services consumption
*CONT.*

63
This slide is intentionally left blank for the notes continued
from the previous slide

64 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

•XML Web services


•Expose functionality as service
•No need to learn XML
•Interface is automatically generated
•Seamless deployment
•Reuse existing Web Services
•VS.NET generates the plumbing
•Full IntelliSense support
•Build and consume with any VS language
*END*

64
References
• Microsoft.com .NET site (http://www.microsoft.com/net):
The definitive resource for what .NET is and why it matters.

• .NET Framework 3.0 (formerly WinFX) http://www.netfx3.com

• Virtual labs at
http://msdn.microsoft.com/virtuallabs/netframe/default.aspx

• Learn .Net 3.0 at


• http://msdn2.microsoft.com/en-us/netframework/default.aspx

• MSDN® Online .NET Information (http://msdn.microsoft.com/net): A


rich source of information for developers worldwide who want to use
.NET technologies and tools

• Visual Studio.NET home page (http://msdn2.microsoft.com/en-


us/vstudio/default.aspx ) Product information for the rapid
application development environment Visual Studio.NET.
65 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge
anytime, anywhere!

65
Thank You
“The contents of this document are proprietary and confidential to Infosys Technologies Ltd. and may
not be disclosed in whole or in part at any time, to any third party without the prior written consent of
Infosys Technologies Ltd.”

“© 2007 Infosys Technologies Ltd. All rights reserved. Copyright in the whole and any part of this
document belongs to Infosys Technologies Ltd. This work may not be used, sold, transferred, adapted,
abridged, copied or reproduced in whole or in part, in any manner or form, or in any media, without the
prior written consent of Infosys Technologies Ltd.”

66 ER/CORP/CRS/LA31/003 We enable you to leverage knowledge


anytime, anywhere!

66

Das könnte Ihnen auch gefallen