Event Driving Chapter - 2
Event Driving Chapter - 2
INTRODUCTION TO .NET
➢ Microsoft has also submitted a Common Language Infrastructure (CLI) Working Document to the
European Computer Manufacturers Association (ECMA), which oversees many of the common
standards in the computer industry.
➢The CLI is a set of specifications needed to create compilers that conform to the .NET Framework.
➢Third-party vendors can also create a CLR that will allow .NET-compliant languages to run on
different platforms. One example, Mono is an open source, cross platform implementation of the
CLR that gives C# applications the ability to run on the Linux platform.
03/12/2022 Compiled By Deresse Demeke 3
Extensibility
➢ To create a highly productive environment in which to program, Microsoft realized
the .NET Framework had to be extensible.
➢Through inheritance and interfaces, you can easily access and extend the functionality
of these classes.
➢For example, you could create a button control class that not only inherits its base
functionality from the button class exposed by the .NET Framework, but also extends
the base functionality in the unique way required by your application.
03/12/2022 Compiled By Deresse Demeke 4
Unified Programming Models
➢ Another important goal Microsoft incorporated into the .NET Framework was cross-language
independence and integration.
➢ To achieve this goal, all languages that support the Common Language Specification (CLS) compile
into the same intermediate language, support the same set of basic data types, and expose the same
set of code accessibility methods.
➢ As a result, not only can classes developed in the different CLS-compliant languages communicate
seamlessly with one another, but you can also implement OOP constructs across languages.
➢ For example, you could develop a class written in C# that inherits from a class written using Visual
Basic (VB).
03/12/2022 Compiled By Deresse Demeke 5
Easier Deployment
➢ Microsoft needed a way to simplify application deployment.
➢Before the development of the .NET Framework, when components were deployed, component information had
to be recorded in the system registry.
➢ Many of these components, especially system components, were used by several different client applications. When
a client application made a call to the component, the registry was searched to determine the metadata needed to
work with the component.
➢ If a newer version of the component was deployed, it replaced the registry information of the old component.
Often, the new components were incompatible with the old version and caused existing clients to fail.
➢ The .NET Framework combats this problem by storing the metadata for working with the component in a file
called a manifest, which is packaged in the assembly containing the component code.
➢By default, an assembly is marked as private and placed in the same directory as the client assembly.
➢This ensures that the component assembly is not inadvertently replaced or modified and also allows for a
simpler deployment because there is no need to work with the registry.
➢If a component needs to be shared, its assembly is deployed to a special directory referred to as the Global
Assembly Cache (GAC).
➢The manifest of the assembly contains versioning information, so newer versions of the component can be
deployed side by side with the older versions in the GAC.
➢By default, client assemblies continue to request and use the versions of the components they were intended to
use.
➢When an assembly is created, it is given a unique identity. When a server assembly is created,
you can grant access permissions and rights.
➢ When a client assembly calls a server assembly, the runtime will check the permissions and
rights of the client, and then grant or deny access to the server code accordingly. Because each
assembly has an identity, you can also restrict access to the assembly through the operating
system.
03/12/2022 Compiled By Deresse Demeke 9
Components of the .NET Framework
1. Common Language Runtime
2. Framework Base Class Library
3. Data Classes
4. Windows Applications
5. Web Applications
6. Windows Store Applications
7. Application Services
➢The CLR manages the code being executed and provides for a layer of abstraction between the code and the
operating system.
➢debugging and tracing code execution and providing structured exception handling
03/12/2022 Compiled By Deresse Demeke 11
.NET Framework and CLR Execution Model
➢Included in this class library are reference types and value types that encapsulate access to the
system functionality.
➢The base class library includes types that encapsulate data structures, perform basic
input/output operations, invoke security management, manage network communication, and
perform many other functions.
03/12/2022 Compiled By Deresse Demeke 13
Data Classes
➢ Built on top of the base classes are classes that support data management.
➢This set of classes is commonly referred to as ADO.NET. Using the ADO.NET object model,
programmers can access and manage data stored in a variety of data storage structures through
managed providers.
➢Microsoft has written and tuned the ADO.NET classes and object model to work efficiently in
a loosely coupled, disconnected, multitiered environment.
➢ADO.NET not only exposes the data from the database, but also exposes the metadata
associated with the data.
➢ This has allowed Windows GUI development to become consistent across the various .NET-enabled
programming languages, combining the ease of development with the full features of the API.
➢The .NET Framework includes a set of classes collectively referred to as the Windows Presentation
Foundation (WPF).
➢WPF integrates a rendering engine that is built to take advantage of modern graphics hardware and
➢Using ASP.NET, you can develop one user interface that can dynamically respond to the type
of client device making the request.
➢ At runtime, the .NET Framework takes care of discovering the type of client making the
request (browser type and version) and exposing an appropriate interface.
➢Another improvement in web application development using the .NET Framework is that
server-side code can be written in any .NET-compliant language.
03/12/2022 Compiled By Deresse Demeke 16
Windows Store Applications
➢ A new type of Windows application is available for the Windows 8 operating system:
the Windows Store app.
➢Windows Store apps are intended for devices such as tablets and phones that take
advantage of touch screens for user input, and continuous Internet connectivity. There
are two options for building Windows Store apps.
➢You can use one of the .NET languages (C#/VB/C++) in combination with XAML
or you can use JavaScript in combination with HTML5.
➢ The compiler translates the source code into Microsoft intermediate language (MSIL) format.
➢ MSIL is CPU-independent code, which means it needs to be further converted into CPU-specific native code before
executing.
➢ Along with the MSIL code, the PE file includes the metadata information contained within the manifest.
➢ The incorporation of the metadata in the PE file makes the code self-describing.
➢ Because the source code for the various .NET-compliant languages is compiled into the same MSIL and metadata format
based on a common type system, the .NET platform supports language integration.
➢ For example, client code written in VB could instantiate and use the methods of a component written in C++.
➢ Before the MSIL code in the PE file is executed, a .NET Framework just-in-time (JIT) compiler converts it into CPU-specific native
code.
➢ To improve efficiency, the JIT compiler does not convert all the MSIL code into native code at the same time.
➢ MSIL code is converted on an as-needed basis. When a method is executed, the compiler checks to see if the code has already been
converted and placed in cache. If it has, the compiled version is used; otherwise, the MSIL code is converted and stored in the cache for
future calls.
➢ Because JIT compilers are written to target different CPUs and operating systems, developers are freed from needing to rewrite their
applications to target various platforms.
➢ It is conceivable that the programs you write for a Windows server platform will also run on a UNIX server. All that is needed is a JIT
compiler for the UNIX architecture.
03/12/2022 Compiled By Deresse Demeke 19
Using the Visual Studio Integrated Development
Environment
➢You can write C# code using a simple text editor and compile it with a command-line
compiler.
➢You will find, however, that programming enterprise-level applications using a text editor
can be frustrating and inefficient.
➢ Most programmers who code for a living find an integrated development environment
(IDE) invaluable in terms of ease of use and increased productivity.
➢ Microsoft has developed an exceptional IDE in Visual Studio (VS). Integrated into VS are
many features that make programming for the .NET Framework more intuitive, easier, and
more productive.
03/12/2022 Compiled By Deresse Demeke 20
Some of Visual Studio’s useful features are:
➢ Editor features such as automatic syntax checking, autocomplete, and color highlighting one IDE for all
.NET languages extensive debugging support, including the ability to set breakpoints, step through code,
and view and modify variables
➢ automated deployment tools that integrate with Windows Installer the ability to view and manage servers
from within the IDE