KGiSL iTechKGiSL iTech
DOTNET FRAMEWORK
KGiSL iTech Page 2
Introduction to .NET
.NET technology was introduced by Microsoft.
.NET is not an operating system
.NET is not a programming language.
.NET is a framework.
KGiSL iTech Page 3
Introduction to .NET(Contd…)
Dot Net Framework is a Programming model of the .NET environment for building, deploying, and running Web-based applications, smart client applications, and XML Web services.
A set of technologies for developing and using components to create: Web Forms Web Services
Windows Applications
The .NET Framework includes the common language runtime and class libraries.
.NET provides a common set of class libraries, which can be accessed from any .NET based programming language.
KGiSL iTech Page 4
Introduction to .NET(Contd…)
It is a new, easy, and extensive programming platform.
It is not a programming language, but it supports several programming languages.
By default .NET comes with few programming languages including C# (CSharp), VB.NET, J# and managed C++.
KGiSL iTech Page 5
Introduction to .NET(Contd…)
Following are the core features of Dot Net Framework
Simplified Programming Model Simplified Deployment Programming Language Integration Garbage Collection Consistent Error Handling
KGiSL iTech
Platform IndependencyLanguage IndependencyLanguage InteroperabilitySecurityFor Windows Applications- net framework supports “Code access security and “role Based security”
For web and mobile applications- Security can be achieved using Configuration files like machine.config and web.config.
Page 6
KGiSL iTech Page 7
Application Architecture
1. Single Tier Architecture2. Two Tier Architecture3. Three Tier Architecture
Single Tier Architecture:The one-tier, or single-tier, architecture is a system in which the database, application, and presentation services (the user interface) all reside on one system. .
KGiSL iTech Page 8
Application Architecture (Contd…)
Two Tier Architecture:- A two tier system consists of a client and a
server.
- A two-tier application is one in which the presentation services and the database reside on different systems.
- The presentation services (user interface) layer usually includes application logic.
KGiSL iTech
Two Tier Architecture
Page 9
KGiSL iTech Page 10
Application Architecture (Contd…)
Three Tier Architecture:
The third tier(Middle tier) is between the user interface(client) and the data management(server).
This middle tier provides process management where business logic and rules are executed.
KGiSL iTech Page 11
Three Tier Architecture
KGiSL iTech
Three Tier Architecture
Tier 1: the client contains the presentation logic, including simple control and user input validation. This application is also known as a thin client.
Tier 2: the middle tier is also known as the application server, which provides the business processes logic and the data access.
Tier 3: the data server provides the business data.
These are some of the advantages of a three-tier architecture:
It is easier to modify or replace any tier without affecting the other tiers.
Separating the application and database functionality means better load balancing.
Page 12
KGiSL iTech Page 13
Application Architecture (Contd…)
Basically,in three tier architecture 3 layers are used to create a projects.
1. UI Layer- UI which includes pages,user controls,CSS,Java
Scripts.
2. Business Layer- All business rules performed here.
3. Data Access Layer
- All data access code like connecting to database and getting the details are done here.
KGiSL iTech Page 14
Three Layers
KGiSL iTech Page 15
Versions of .NET
.NET Framework Visual Studio
.NET Framework 1.0 Visual Studio 2002
.NET Framework 1.1 Visual Studio 2003
.NET Framework 2.0 Visual Studio 2005
.NET Framework 3.5 Visual Studio 2008
.NET Framework 4.0 Visual Studio 2010
KGiSL iTech Page 16
VS.NET is just an editor, provided by Microsoft to help developers write .NET programs easily .
VS.NET editor automatically generates lot of code, allows developers to drag and drop controls to a form, provide short cuts to compile and build the application etc.
VS.NET has several child windows to assist you in the application development.
These windows are attached on the left, bottom and right sides of the main window.
VS.NET(Visual Studio.NET)
KGiSL iTech Page 17
VS.NET(Visual Studio.NET) (Contd…)
Some of the most commonly used child windows are explained below. Most of these windows will be enabled only when you have created a project and working on a WebForm/WinForm.
Tool Box•Toolbox provides all the drag and drop controls for your
application.
• Depending on the kind of application you are working on, the toolbox will show appropriate controls.
KGiSL iTech Page 18
Tool Box
KGiSL iTech Page 19
VS.NET(Visual Studio.NET) (Contd…)
Source(HTML) & Design Mode• If you are developing a web application, you can switch
between design mode and HTML mode for any web form.
•When you are in HTML mode, it will show you the HTML tags and ASP.NET code and you can manually edit it.
•You can switch to the Design mode by clicking the Design button on BOTTOM LEFT corner of VS.NET.
• In design mode, you can see how your ASP.NET page is going to look like when some one view your web page. Also, you can drag and drop controls from the toolbox, which will automatically generate the HTML for it.
KGiSL iTech
Source(HTML) & Design Mode
Page 20
KGiSL iTech Page 21
VS.NET(Visual Studio.NET) (Contd…)
Solution Explorer Window•Solution Explorer, located on TOP RIGHT corner of VS.NET,
displays your solution, all projects included in each solution and the list of files in each project. They are listed in the form of a tree control.
Output Window•Output window, located on BOTTOM LEFT corner of VS.NET,
displays the result of your project compilation. When you compile your project, all errors, warnings and compilation results will be displayed in this window.
KGiSL iTech
Solution Explorer Window
Page 22
KGiSL iTech Page 23
VS.NET(Visual Studio.NET) (Contd…)
Task List Window• It shows individual tasks. Typically, when you compile your
project, all errors and warnings will be added to your task list. You can double click on any item in the task list to go directly to the code associated with the task.
Properties Window• It displays the different types of property for each and every
control. The common property for all controls are Font, Color, Forecolor
and so on.
Code behind window- Code-behind model, which places this code in a separate file or in a
specially designated script tag. - Code-behind files typically have names like Firstpage.aspx.cs or
Firstpage.aspx.vb
KGiSL iTech
Properties Window
Page 24
KGiSL iTech
Code Behind Window
Page 25
KGiSL iTech Page 26
Shortcut Keys
Compilation and Execution – F5
Toolbox Window– Ctrl + Alt + X
Property Window – F4
Solution Explorer – Ctrl + Alt + L
Design View to Code View – F7(Code Behind Window)
Code View to Design View – Shift + F7(Source Window)
KGiSL iTech Page 27
KGiSL iTech Page 28
.NET Framework.NET Framework Common Language RuntimeCommon Language Runtime
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
- CLR manages code execution at runtimeCLR manages code execution at runtime
- Memory management, thread management, etc.Memory management, thread management, etc.
KGiSL iTech Page 29
.NET Framework.NET Framework Base Class LibraryBase Class Library
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
- Object-oriented collection of reusable typesObject-oriented collection of reusable types
- Collections, I/O, Strings, …Collections, I/O, Strings, …
KGiSL iTech Page 30
.NET Framework.NET Framework Data Access LayerData Access Layer
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
- Access relational databasesAccess relational databases
- Disconnected data modelDisconnected data model
- Work with XMLWork with XML
KGiSL iTech Page 31
.NET Framework.NET Framework ASP.NET & Windows FormsASP.NET & Windows Forms
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
- Create application’s front-end – Web-based user interface, Create application’s front-end – Web-based user interface, Windows GUI, Web services, …Windows GUI, Web services, …
KGiSL iTech Page 32
.NET Framework.NET Framework Programming LanguagesProgramming Languages
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
C++C++ C#C# VB.NETVB.NET PerlPerl J#J# ……
- Use your favorite languageUse your favorite language
KGiSL iTech Page 33
.NET Framework.NET Framework Common Language SpecificationCommon Language Specification
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language SpecificationC++C++ C#C# VBVB PerlPerl J#J# ……
KGiSL iTech Page 34
.NET Framework.NET Framework Visual Studio .NETVisual Studio .NET
Operating SystemOperating System
Common Language RuntimeCommon Language Runtime
.NET Framework (Base Class Library).NET Framework (Base Class Library)
ADO .NET and XMLADO .NET and XML
ASP .NETASP .NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
Common Language SpecificationCommon Language Specification
C++C++ C#C# VBVB PerlPerl J#J# ……
Visu
al S
tud
io .N
ET
Visu
al S
tud
io .N
ET
KGiSL iTech Page 35
KGiSL iTech Page 36
.NET Architecture
NET Compliant Language- Language which supports .NET Programming like Vb.NET,C#,C++
and J# etc.
.NET Application- Application which is developed by using .NET Framework.- Like Windows Application, Web Application, Web Service and
Mobile Application.
.NET Framework Class Library- It consist of thousands of Pre-developed classes that can be used
to build application.
KGiSL iTech Page 37
.NET Architecture
Common Type System(CTS)- A superset of the data types used by most modern programming
languages.- CTS, common type system is the one which brings all .NET
languages data types on a common platform.
Common Language Specification(CLS)- A subset of CTS that allows code written in different languages to
interoperate
What languages? - Microsoft: C++, Visual Basic, C#, JScript - Third-Party: Cobol, Eiffel, Smalltalk, Scheme, Oberon,
Haskell, Java, Python, Perl, …
KGiSL iTech
CLR
Common Language Runtime(CLR)- Its a virtual machine of Microsoft's .NET,- During Compile time the Source code(C#, VB.Net..) is
converted into Intermediate Language (MSIL),During Runtime this IL is converted to native code to Operating System by Just In Time (JIT) of CLR
Page 38
KGiSL iTech Page 39
KGiSL iTech Page 40
The CLR CompilationThe CLR Compilation
SourceSource codecodeSourceSource codecode
CompilerCompiler
AssemblyAssemblyAssemblyAssembly
DLL or EXEDLL or EXEC++, C#, J#, C++, C#, J#, Visual Basic or Visual Basic or any .NET any .NET languagelanguage
KGiSL iTech Page 41
KGiSL iTech Page 42
KGiSL iTech
Common Language Runtime Services
Code management Conversion of MSIL to native code Loading and execution of managed code Creation and management of metadata Verification of type safety Insertion and execution of security checks Memory management and isolation Handling exceptions across languages Interoperation between .NET Framework objects and COM objects and
Win32 DLLs Automation of object layout for late binding Developer services (profiling, debugging, etc.)
Page 43
KGiSL iTech Page 44
Applications developed by .NET
-Windows Application-Web Application-Web Services-Console Applications-Mobile Applications
KGiSL iTech
Page 45
CLR - The execution modelCLR - The execution model
VBVBSource Source codecode
CompilerCompiler
C++C++C#C#
CompilerCompilerCompilerCompiler
AssemblyAssemblyIL codeIL code
AssemblyAssemblyIL codeIL code
AssemblyAssemblyIL codeIL code
Operating system servicesOperating system services
JIT compilerJIT compiler
Native codeNative code
ManagedManagedcodecode
UnmanagedUnmanagedcomponentcomponent
Common language runtimeCommon language runtime
JIT compilerJIT compiler
KGiSL iTech Page 46
NET supports two kinds of coding
Managed Code Unmanaged Code
Managed Code- The code, which is developed in .NET framework, is known as
managed code. This code is directly executed by CLR with help of managed code execution.
Unmanaged Code- The code, which is developed outside .NET Framework is known as
unmanaged code.
KGiSL iTech Page 47
Assembly
The .NET framework introduces assemblies as the main building blocks of your application.
An Assembly is a logical unit of code
An application can contains one or more assemblies.
An assembly can be formed in one or more files.
Assembly physically exist as DLLs or EXEs
When you compile your source code by default the exe/dll generated is actually an assembly
KGiSL iTech Page 48
Assembly Contd….
An assembly can consist of the following four elements:
1.Source code, compiled into MS intermediate language (MSIL). This code file can be either an EXE file or a DLL file.
2.The assembly manifest, - which is a collection of metadata that describes assembly name, - culture settings, - list of all files in the assembly, - security identity, version requirements, - and references to resources. - The assembly manifest can be stored with the intermediate code, or in a
standalone file that contains only assembly manifest information.
3.Type metadata
4.Resources
KGiSL iTech Page 49
Assembly Contd….
Assembly Version- An assembly can have two types of versions.
1. "Version Number"
- consists of a four-part string with the following format:
- <Major Version>.<Minor Version>.<Build Number>.<Revision Number>
- For example a version number of 3.5.20.1 indicates 3 as the major version, 5 as the minor version, 20 as the build number, and 1 as the revision number.
KGiSL iTech Page 50
Assembly Contd….
2. The second type of versions is called "Informational Version".
-The informational version consists of a string that contains the version number besides additional information like packaging, marketing literature, or product name.
KGiSL iTech Page 51
Private Assembly and Shared Assembly
Private Assembly The assembly which is used only by a single application is called
as private assembly. This DLL will be used by your client application only and not by any
other application. In order to run the application properly your DLL must reside in the
same folder in which the client application is installed. Thus the assembly is private to your application.
Shared Assembly
Creating a general purpose DLL which provides functionality which will be used by variety of applications.
This type of DLL’s are placed in 'global assembly cache'.
Such assemblies are called as shared assemblies
KGiSL iTech Page 52
Global Assembly Cache
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept.
It is located under <drive>:\WinNT\Assembly folder.