SlideShare ist ein Scribd-Unternehmen logo
1 von 43
UNIT – 1
Unit-01/Lecture-01
Introduction to .NET Technology
Introduction DOT NET TECHNOLOGY: [RGPV/June2009]
The .NET platform is an integral component of the Microsoft Windows operating system for
building and running next generation software applications and Web services. The .NET
development framework provides a new and simplified model for programming and deploying
applications on the Windows platform. It provides such advantages as multiplatform
applications, automatic resource management, and simplification of application deployment. As
security is an essential part of .NET, it provides security support, such as code authenticity
check, resources access authorizations, declarative and imperative security, and cryptographic
security methods for embedding into the user’s application.
. .NET provides a simple object-oriented model to access most of the Windows application
programming interfaces (APIs). It also provides mechanisms by which you can use the existing
native code. In addition, it significantly extends the development platform by providing tools
and technologies to develop Internet-based distributed applications
Microsoft started development of .NET Framework in the late 1990s, originally under the name
of Next Generation Windows Services (NGWS). By late 2000, the first beta versions of .NET 1.0
were released.
Version 3.0 of .NET Framework is included with Windows Server 2008 and Windows Vista.
Version 3.5 is included with Windows 7 and Windows Server 2008 R2, and can also be installed
on Windows XP and Windows Server 2003.[2] On 12 April 2010, .NET Framework 4 was released
alongside Visual Studio 2010.
Unit-01/Lecture-02
Introduction to VB.NET
Introduction to VB.NET: [RGPV/June2010]
Visual Basic .NET (VB.NET) is a multi-paradigm, high level programming language,
implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the
successor to its original Visual Basic language. Along with Visual C#, it is one of the two
main languages targeting the .NET framework.
Microsoft currently supplies two main editions of IDE for developing in VB.NET: Microsoft
Visual Studio 2013, which is commercial software and Visual Studio Express Edition 2013,
which is free of charge. The command-line compiler, VBC.EXE, is installed as part of the
freeware .NET Framework SDK. Mono also includes a command-line VB.NET compiler.
VISUAL BASIC is a high level programming language which evolved from the earlier DOS
version called BASIC. BASIC means Beginners' All-purpose Symbolic Instruction Code. It is
a very easy programming language to learn. The code look a lot like English Language.
Different software companies produced different versions of BASIC, such as Microsoft
QBASIC, QUICKBASIC, GWBASIC, IBM BASICA and so on. Now, there are many versions of
VB exist in the market, the most popular one and still widely used by many VB
programmers is none other than Visual Basic 6. We also have VB.net, VB2005, VB2008.
VISUAL BASIC is a VISUAL and events driven Programming Language. These are the main
divergence from the old BASIC. In BASIC, programming is done in a text-only
environment and the program is executed sequentially. In VB, programming is done in a
graphical environment. In the old BASIC, you have to write program code for each
graphical object you wish to display it on screen, including its position and its color.
However, In VB , you just need to drag and drop any graphical object anywhere on the
form, and you can change its color any time using the properties windows.
On the other hand, because the user may click on certain object randomly, so each
object has to be programmed independently to be able to response to those actions
(events). Therefore, a VB Program is made up of many subprograms, each has its own
program code, and each can be executed independently and at the same time each can
be linked together in one way or another.
Example: simple program. First of all, you have to launch Microsoft Visual Basic 6.
Normally, a default form with the name Form1 will be available for you to start your new
project. Now, double click on Form1, the source code window for Form1 as shown the
top of the source code window consists of a list of objects and their associated events or
procedures. the object displayed is Form and the associated procedure is Load.
VB.NET has the following syntax:
• Statements can terminate with keywords such as "End If", instead of using "{}"s to
group statements.
• Statements can also be terminated with a new line, instead of semicolons.
• Variables are both assigned and compared using an equals sign.
• Round brackets are used with arrays, both to declare them and to get a value at a
given index in one of them.
The following is a very simple VB.NET program, a version of the classic "Hello world"
example created as a console application:
Module Module1
Sub Main()
Console.WriteLine ("Hello, world!")
End Sub
End Module
Features of VB.NET: [ RGPV/june2009,June2010,Dec2012]
Interoperability:-
Because computer systems commonly require interaction between newer and older
applications, .NET Framework provides means to access functionality implemented in
newer and older programs that execute outside .NET environment. Access to COM
components is provided in the System.Runtime.Interop Services and System. Enterprise
Services namespaces of the framework; access to other functionality is achieved using
the P/Invoke feature.
Common Language Runtime engine:-
The Common Language Runtime (CLR) serves as the execution engine of .NET
Framework. All .NET programs execute under the supervision of the CLR, guaranteeing
certain properties and behaviors in the areas of memory management, security, and
exception handling.
Language independence:-
.NET Framework introduces a Common Type System, or CTS. The CTS specification
defines all possible data types and programming constructs supported by the CLR and
how they may or may not interact with each other conforming to the Common
Language Infrastructure (CLI) specification. Because of this feature, .NET Framework
supports the exchange of types and object instances between libraries and applications
written using any conforming .NET language.
Framework Class Library:-
The Framework Class Library (FCL) is a library of functionality available to all languages
using .NET Framework. The FCL provides classes that encapsulate a number of common
functions, including file reading and writing, graphic rendering, database interaction,
XML document manipulation, and so on. It consists of classes, interfaces of reusable
types that integrates with CLR (Common Language Runtime).
Simplified deployment:-
.NET Framework includes design features and tools which help manage the installation
of computer software to ensure it does not interfere with previously installed software,
and it conforms to security requirements.
Security:-
The design addresses some of the vulnerabilities, such as buffer overflows, which have
been exploited by malicious software. Additionally, .NET provides a common security
model for all applications.
Portability:-
While Microsoft has never implemented the full framework on any system except
Microsoft Windows, it has engineered the framework to be platform-agnostic and
cross-platform implementations are available for other operating systems . Microsoft
submitted the specifications for the Common Language Infrastructure (which includes
the core class libraries, Common Type System, and the Common Intermediate
Language).
Memory management:-
.NET Framework CLR frees the developer from the burden of managing memory
(allocating and freeing up when done); it handles memory management itself by
detecting when memory can be safely freed. Instantiations of .NET types (objects)
are allocated from the managed heap; a pool of memory managed by the CLR. As
long as there exists a reference to an object, which might be either a direct
reference to an object or via a graph of objects, the object is considered to be in
use. When there is no reference to an object, and it cannot be reached or used, it
becomes garbage, eligible for collection. .
Unit-01/Lecture-03
Software development and Visual Basic .NET and versions
Software development:-
Software engineering is not easy to define; indeed, many argue that it is not a form of
engineering at all and that its designers are not really engineers. But software developers are
engineers and include in their ranks many professionals with formal training and experience.
According to Webster's dictionary, engineering is the application of mathematical and scientific
principles to practical ends, as the design, construction, and operation of efficient structures,
equipment, and systems.
The software industry emerged in the mid−20th
century with the advent of the modern
computer and has progressed through three distinct "ages" since then:
 The Procedure−Oriented Age:
Procedure−oriented programming was largely concerned with computational results rather
than data the focus being on procedures, or just code, as islands of functionality. Software
systems were not organized in any meaningful structure and were merely
collections of files containing huge functions and procedures that were processed as required
fordiscrete calculations. Data was external to the functional black box and easily accessible
because it was global. Because the systems were fixated on a result, a value, they could be
S.NO RGPV QUESTIONS Year Marks
Q.1 What are the benefits of .NET framework? Dec2013 04
Q.2 Discuss the features of .NET technology. Dec2012 07
Q.3 Briefly describe the VB.NET and also explain the
features of VB.NET.
June2010 10
Q.4 What are the Features of .NET? Explain CTS. June2009 10
adequately managed by the very dedicated individuals that wrote them.
 The Structure−Oriented Age
As software systems grew, programmers needed to manage and maintain them more
efficiently. The structure−oriented age introduced a paradigm in which the functions were
organized in structures a module containing procedures and data. In other words, the unit or
level of abstraction became the module rather than the individual procedure. Structural
programming lends itself to encapsulation, data−centric programming, collections of like
routines, and object−like programming.
 The Object−Oriented Age
By the end of the 1960s it became apparent that the ever−growing complexity of software
systems would necessitate a new model, one that was more humanly
Manageable and comprehensible. Now almost half a century after the first object−oriented
software language, Simula, was created, the OO age has finally taken hold in response to this
complexity. OO lets us model and design software systems around familiar concepts (objects)
behind which complexity is hidden through abstraction, much like the abstraction found in
nature. The focus of programming is mostly on attributes and data rather than computations or
calculations. Encapsulation
and other features have been refined, and continue to be refined, to better serve the OO
model.
The Classic Programming Models:-
• Structured Programming:-
Structured programming (sometimes known as modular programming) is a subset of
procedural programming that enforces a logical structure on the program being written to
make it more efficient and easier to understand and modify. Certain languages such as Ada,
Pascal, and dBASE are designed with features that encourage or enforce a logical program
structure.
Structured programming frequently employs a top-down design model, in which developers
map out the overall program structure into separate subsections. A defined function or set of
similar functions is coded in a separate module or submodule, which means that code can be
loaded into memory more efficiently and that modules can be reused in other programs. After a
module has been tested individually, it is then integrated with other modules into the overall
program structure.
Program flow follows a simple hierarchical model that employs looping constructs such as "for,"
"repeat," and "while." Use of the "Go To" statement is discouraged.
Bug−Reduced Code:-
The boundaries of buggy code are within the confines of a module, which is usually the
responsibility of one programmer. It is much easier to detect a bug in a module through
isolation than in a file containing a single mega−procedure. Once the bugs are dispatched from
the modules, the pest−free code can then be reused in other parts of the application.
Divide and Conquer:-
The strongest Roman emperors realized that the solution to conquering their enemies was to
divide the armies of resisters and then conquer the smaller units. Modern analytical problem−
solving techniques teach the same approach, as do many successful algorithm masters. The
best way to solve a problem is to restate it in as many ways as you possibly can; this helps
identify the "real" problem, which you then break down into smaller components.
Reuse:-
Contrary to what many OO purists claim, reuse became the battle cry of software professionals
long before the rise of object−orientation. The idea even predates the industrial revolution,
which heralded the effort to make better products through faster and cheaper means.
• Object−Based Programming:-
As structured programming methods became more refined, it became apparent to the
engineers that modules of code could be related to as objects. Many languages gradually
become more object−based, especially as compilers emerged that could enforce encapsulation
and cater to the compiling, linking, and binding of
numerous modules into complete applications.
A good example of object−based programming plots the transformation of C into C++. Today C+
+ is what you would call a hybrid language because it allows you to code standard C modules, to
add objects and do object−based programming, or to invoke the object−oriented features of
the language such as inheritance and
Polymorphism.
Object−Oriented Software Development:-
1. A "pure" or "true" object−oriented language thus comprises the following traits:
Modularity is achieved in modules called classes, the unit of encapsulation.
2. Related classes are grouped in hierarchies. The classes are related by descent
Inheritance.
3. The classes can be instantiated at runtime as objects, and their functionality and data
dynamically accessed. (Class functionality can also be statically accessed without
instantiation.)
4. Objects access one another's data and implementation using messages passed between
them.
5. Objects are able to dynamically respond in different ways and serve up variations in
functionality in response to the same message polymorphism. Through the employment of
interfaces, polymorphism is achieved because different implementations can exist behind
the same interface used in more than one place.
If you expected to find encapsulation on the list, you might be surprised. Let's consider some of
the points made earlier. Encapsulation is often cited as one of the three most important tenets
of an OO language (inheritance and polymorphism are the other two). But while it is vital to OO,
encapsulation is really a trait of all modern programming methodology, adopted without
question by OOP from both object−based programming and structured programming practice.
Encapsulation was certainly supported in the earlier versions of Visual Basic. Therefore,
inheritance and polymorphism are the two critical enabling features of all true OO languages.
Visual Basic now supports both.
 Versions:- [RGPV/Dec2011]
Succeeding the classic Visual Basic version 6.0, the first version of Visual Basic .NET debuted in
2002. As of 2014, seven versions of Visual Basic .NET are released.
• 2002 (VB 7.0)
The first version, Visual Basic .NET, relies on .NET Framework 1.0. The most important feature is
managed code, which contrasts with the classic Visual Basic.
• 2003 (VB 7.1)
Visual Basic .NET 2003 was released with .NET Framework 1.1. New features included support
for the .NET Compact Framework and a better VB upgrade wizard. Improvements were also
made to the performance and reliability of .NET IDE (particularly the background compiler) and
runtime. In addition, Visual Basic .NET 2003 was available in the Visual Studio.NET Academic
Edition, distributed to a certain number of scholars from each country without cost.
• 2005 (VB 8.0)
After Visual Basic .NET 2003, Microsoft dropped ".NET" from the name of the product, calling
the next version Visual Basic 2005.
For this release, Microsoft added many features intended to reinforce Visual Basic .NET's focus
as a rapid application development platform and further differentiate it from C#., including:
• Edit and Continue feature Design-time expression evaluation
• A pseudo-namespace called "My", which provides:
o Easy access to certain areas of the .NET Framework that otherwise require
significant code to access Dynamically generated classes (e.g. My.Forms)
• Improved VB-to-VB.NET converter
• A "using" keyword, simplifying the use of objects that require the Dispose pattern to
free resources
• Just My Code feature, which hides (steps over) boilerplate code written by the Visual
Studio .NET IDE and system library code during debugging
• Data Source binding, easing database client/server development
To bridge the gaps between itself and other .NET languages, this version added:
• Generics
• Partial classes, a method of defining some parts of a class in one file and then adding
more definitions later; particularly useful for integrating user code with auto-generated
code
• Operator overloading and null able types
• Support for unsigned integer data types commonly used in other languages
Visual Basic 2005 introduced the IsNot operator that makes 'If X IsNot Y' equivalent to 'If Not X
Is Y'. It gained notoriety when it was found to be the subject of a Microsoft patent application.
• 2008 (VB 9.0)
Visual Basic 9.0 was released along with .NET Framework 3.5 on 19 November 2007.
For this release, Microsoft added many features, including:
• A true conditional operator, "If(condition as boolean, truepart, falsepart)", to replace
the "IIf" function.
• Anonymous types
• Support for LINQ
• Lambda expressions
• XML Literals
• Type Inference
• Extension methods
• 2010 (VB 10.0)
In April 2010, Microsoft released Visual Basic 2010. Microsoft had planned to use Dynamic
Language Runtime (DLR) for that release but shifted to a co-evolution strategy between Visual
Basic and sister language C# to bring both languages into closer parity with one another. Visual
Basic's innate ability to interact dynamically with CLR and COM objects has been enhanced to
work with dynamic languages built on the DLR such as IronPython and IronRuby. The Visual
Basic compiler was improved to infer line continuation in a set of common contexts, in many
cases removing the need for the "_" line continuation character. Also, existing support of inline
Functions was complemented with support for inline Subs as well as multi-line versions of both
Sub and Function lambdas.
• 2012 (VB 11.0)
Visual Basic .NET 2012 was released along .NET Framework 4.5. Major features introduced in
this version include:
• Asynchronous programming with "async" and "await" statements
• Iterators
• Call hierarchy
• Caller information
• "Global" keyword in "namespace" statements
version Version
Number
Release
Date
Visual Studio Default in Windows
1.0 1.0.3705.0 2002-02-
13
Visual
Studio .NET
1.1 1.1.4322.573 2003-04-
24
Visual Studio
.NET 2003
Windows Server
2003
2.0 2.0.50727.42 2005-11-
07
Visual Studio
2005
Windows Server
2003 R2
3.0 3.0.4506.30 2006-11-
06
Windows Vista,
Windows Server
2008
3.5 3.5.21022.8 2007-11-
19
Visual Studio
2008
Windows 7,
Windows Server
2008 R2
4.0 4.0.30319.1 2010-04-
12
Visual Studio
2010
Hardware and Software Requirements:- [RGPV/Dec2013]
This topic gives the requirements for Studio Enterprise Edition Windows Components.
Hardware Requirements
The following minimum configuration is required:
• Processor: Must be at least the minimum specified for the operating system you are
using and for Visual Studio.
• Memory: Must be at least the minimum specified for the operating system you are
using.
• Disk space:
o 1.2Gb for Studio Enterprise Edition
This disk size includes the space needed to cache information locally so that you can
modify the installation without the original source media.
• DVD drives (either locally or via a network).
• Screen with resolution of 800x600 with 256 colors minimum. Preferred screen
resolution 1024 x 768 or higher.
• Studio Enterprise Edition has additional hardware requirements the same as for
Microsoft Visual Studio. See the Visual Studio documentation for details.
Software Requirements
The following software is required:
• On 32-bit Windows, one of:
o Windows Vista
o Windows Server 2008
o Windows Server 2003 R2, Windows Server 2003
o Windows XP Professional SP2 or later
• On 64-bit Windows for X64, one of:
o Windows Vista
o Windows Server 2008
o Windows Server 2003
o Windows XP Professional
• Microsoft Visual Studio 2008 Service Pack 1 or Microsoft Visual Studio Shell 2008. Note
that Microsoft Visual Studio Express Edition is not supported.
• Microsoft Windows SDK is required if you are using Visual Studio Shell 2008. See the
Microsoft Download site and search for Windows SDK.
• Microsoft .NET Framework 3.5. This is included with the above versions of Visual Studio.
• The Java Development Kit (JDK) is required for compiling Java. The JDK is downloadable
from the Sun Web site. After installing the JDK, you must put the tools.jar file for the JDK
on your classpath, using a command similar to:
set class path=jdk-install-directorylibtools.jar
• A Web browser, such as Microsoft Internet Explorer 6.0 or Netscape Navigator 6.1., is
required for Enterprise Server Administration in Server Enterprise Edition.
• To use Enterprise Server Administration, scripting or JavaScript support must be enabled
in your browser. This is on by default in Internet Explorer in most Windows operating
systems, apart from Windows 2003. Also, active content must be allowed and not
blocked. To enable both these in Internet Explorer:
1. Click Tools > Internet Options.
2. On the Security tab, click Custom Level. In the Scripting section, under Active
Scripting, click Enable.
3. On the Advanced tab, scroll down the list to the Security section, and ensure the
item Allow active content to run in files on My Computer is checked.
• Enterprise Server Help requires the Sun Java Run-time Environment on some Windows
systems to enable the Search facility to work. See Third Party Software
S.NO RGPV QUESTIONS Year Marks
Q.1 Write down Microsoft .NET versions released up to 2010 with
version name, version number and release date.
Dec2011 10
Q.2 List of essential hardware and software components required
to install VB 2008.
Dec2013 07
Unit-01/Lecture-04
.NET frame work,CTS,CLR,CLS.MSIL,JIT
.NET frame work:[ RGPV/ June2009,Dec2010,Dec2011,Dec2013]
.NET Framework (pronounced dot net) is a software framework developed by Microsoft that runs
primarily on Microsoft Windows. It includes a large library and provides language interoperability
(each language can use code written in other languages) across several programming languages.
Programs written for .NET Framework execute in a software environment (as contrasted to
hardware environment), known as the Common Language Runtime (CLR), an application virtual
machine that provides services such as security, memory management, and exception handling.
The class library and the CLR together constitute .NET Framework.
.NET Framework's Framework Class Library provides user interface, data access, database
connectivity, cryptography, web application development, numeric algorithms, and network
communications. Programmers produce software by combining their own source code with .NET
Framework and other libraries. .NET Framework is intended to be used by most new applications
created for the Windows platform. Microsoft also produces an integrated development
environment largely for .NET software called Visual Studio.
Microsoft .NET Framework 4 is Microsoft's comprehensive and consistent programming model for
building applications that have secure communication and the ability to model a range of business
processes. It provides improvements in Common Language Runtime (CLR) and Base Class Library
(BCL), new memory mapped file and numeric types, innovations in the Visual Basic and C#
languages, and support for Windows 7 multi-touch, ribbon controls, taskbar extensibility features,
and Surface 2.0 SDK. WCF Data Services is a component of the .NET Framework that enables you
to create REST-based services and applications that use the Open Data Protocol (OData) to expose
and consume data over the Web.
The .NET Framework is a technology that supports building and running the next generation of
applications and XML Web services. The .NET Framework is designed to fulfill the following
objectives:
• To provide a consistent object-oriented programming environment whether object code is
stored and executed locally, executed locally but Internet-distributed, or executed
remotely.
• To provide a code-execution environment that minimizes software deployment and
versioning conflicts.
• To provide a code-execution environment that promotes safe execution of code, including
code created by an unknown or semi-trusted third party.
• To provide a code-execution environment that eliminates the performance problems of
scripted or interpreted environments.
• To make the developer experience consistent across widely varying types of applications,
such as Windows-based applications and Web-based applications.
• To build all communication on industry standards to ensure that code based on the .NET
Framework can integrate with any other code.
Introduction To MSIL code, CLR, CTS, CLS and JIT In .NET:-
The developer writes source code in any .NET language i.e. it may VB.NET or C# or VC+++.NET, etc.
The source code is compiled to Intermediate code known as IL code by the respective compilers
for example for C# it is csc.exe compiler, for VB.NET it is vbc.exe compiler, etc. This half compiled
code is then given to JIT(just in time compiler) by CLR which converts IL code to machine specific
instructions which then gets executed. In this way a .NET code gets compiled. For better
understanding have a look to following diagram :
MSIL Code :
The word IL Code stands for Intermediate Language Code. It is a CPU independent partially
compiled code. When we develop our .NET application, we don’t know in what kind of
environment our code will run i.e. on which operating system it will be finally hosted, what will
be the CPU configuration, etc. So for this purpose we have IL code which is compiled according
to machine configuration. IL code is given by Language compiler which is different for different
languages for example csc.exe compiler for C#, vbc.exe compiler for VB.NET, etc.
CLR (Common language runtime):
The common language runtime manages memory, thread execution, code execution, code
safety verification, compilation, and other system services. These features are intrinsic to the
managed code that runs on the common language runtime.
With regards to security, managed components are awarded varying degrees of trust,
depending on a number of factors that include their origin (such as the Internet, enterprise
network, or local computer). This means that a managed component might or might not be
able to perform file-access operations, registry-access operations, or other sensitive functions,
even if it is being used in the same active application.
The runtime enforces code access security. For example, users can trust that an executable
embedded in a Web page can play an animation on screen or sing a song, but cannot access
their personal data, file system, or network. The security features of the runtime thus enable
legitimate Internet-deployed software to be exceptionally feature rich.
CLR stands for Common Language Runtime. It is the heart of our .NET Framework. CLR
performs following tasks :
1. Garbage Collection :
When we run our .NET application, many objects are created. Garbage collection is a
background process which deletes the objects which are not in use by the application and
frees memory.
2. Code Access Security(CAS) and Code Verification(CV) :
CLR checks the whether the code has access rights and it is safe and authenticated to be
used.
3. IL to Native Translation :
The main task of CLR is to provide IL code to JIT to ensure that code is fully compiled as per
machine specification.
The runtime provides the following benefits:
• Performance improvements.
• The ability to easily use components developed in other languages.
• Extensible types provided by a class library.
• Language features such as inheritance, interfaces, and overloading for object-oriented
programming.
• Support for explicit free threading that allows creation of multithreaded, scalable
applications.
• Support for structured exception handling.
• Support for custom attributes.
• Garbage collection.
• Use of delegates instead of function pointers for increased type safety and security. For
more information about delegates, see Common Type System.
CTS(Common Types System):
CTS stands for Common Types System. In .NET we have various languages like C#, VB.NET,
etc. There may be many situations where we want code written in one language to be used
in another. In order to ensure that we have a smooth communication between different
languages, we have CTS. CTS ensures that data types defined in two different languages
get compiled to a common data type so that code written in one language can be used by
another.
The runtime also enforces code robustness by implementing a strict type-and-code-
verification infrastructure called the common type system (CTS). The CTS ensures that all
managed code is self-describing. The various Microsoft and third-party language compilers
generate managed code that conforms to the CTS. This means that managed code can
consume other managed types and instances, while strictly enforcing type fidelity and type
safety.
CLS(Common Language Specifications) :
CLS stands for Common Language Specifications. It is a subset of CTS. CLS is a set of rules or
guidelines which if followed ensures that code written in one .NET language can be used by
another .NET language. For example one rule is that we cannot have member functions
with same name with case difference only i.e we should not have add() and Add(). This
may work in C# because it is case-sensitive but if try to use that C# code in VB.NET, it is not
possible because VB.NET is not case-sensitive.
Common language specification Rules:
It describes the minimal and complete set of features to produce code that can be hosted by CLR.
It ensures that products of compilers will work properly in .NET environment.
Sample Rules:
1. Representation of text strings
2. Internal representation of enumerations
3. Definition of static members and this is a subset of the CTS which all .NET languages
are expected to support.
4. Microsoft has defined CLS which are nothing but guidelines that language to follow so
that it can communicate with other .NET languages in a seamless manner.
JIT(Just In Timer Compiler) :
JIT stands for Just In Timer Compiler. It is the internal compiler of .NET which takes IL code
from CLR and executes it to machine specific instructions.
S.NO RGPV QUESTIONS Year Marks
Q.1 What are the features of .NET? Explain the CTS. June2009 10
Q.2 Describe .NET framework with their components (CTS, CLS,
and CLR).
Dec 2011 10
Q.3 Define the role of CLR in .NET framework. Dec 2012 7
Q.4 Give architecture of .NET framework,give a brief various
components of .NET framework.
Dec.2013 7
Q.5 Explain the following terms: MSIL, CLR, CTS, Object code. Dec.2013 7
Unit-01/Lecture-05
Comparison between VB.Net and VB 6.0 and Similarity between java and
.NET[RGPV/june2009]
Comparison between VB.Net and VB 6.0:-
The current VB6 code base will not run under VB.NET due to changes in VB.NET's syntax and language,
its use of the new common runtime, and its switch to WinForms from the VB6 form model. Visual
Basic.NET includes an upgrade tool to assist in converting VB6 projects to .NET. The tool adds an
upgrade report to your project listing any problems and inserts comments into your code and To Do
items into the new Task List indicating where additional changes need to be made.
 Variable Declaration:-
Always declare variables on separate lines. I always thought this to be good practice anyway.
Dim lngOne As Long
Dim lngTwo As Long
The above statement declares both variables as Long.
Dim lngOne, lngTwo As Long
This statement, however, declares lngOne as a Variant (which is not supported in .NET) and
lngTwo as a Long.
 Data Types:-
Since VB.NET uses a common runtime among Visual Studio languages, data types in VB
needed to be brought into line with those of other languages. Here are some of the data type
changes.
VB6 VB.NET Comments
Integer Short 16 bits
Long Integer 32 bits
N/A Long 64 bits
Variant N/A Use the new 'Object' data type
Currency N/A
Use Decimal in VB6 or Decimal or Long in
VB.NET
N/A Decimal Available* in VB6. Native in VB.NET
String String VB.NET doesn't support fixed length strings
VB.NET no longer supports the Variant and Currency data types. VB documentation has always
warned to minimize your use of variants. In .Net they are not supported. Use the object data type
instead.
The currency data type stores values as 64-bit integers, scaled by 10,000 to give a fixed-point
number with 15 digits to the left of the decimal point and 4 digits to the right. In VB.NET you
can replace currency variables with the new 64-bit Long variable or the 64-bit decimal data type.
 Deprecated Commands:-
VB.NET no longer supports the VarPtr, ObjPtr and StrPtr functions which retrieved the
underlying memory address of variables. It also no longer supports the LSet command which
was used to convert one user defined type to another.
Some defunct keywords are: GoSub, Let, Is Missing, DefBool, DefByte, DefLng, DefCur,
DefSng, DefDbl, DefDec, DefDate, DefStr, DefObj and DefVar as well as On x Goto.
Here are more affected commands:
VB6 VB.NET Namespace Method/Property
Circle System.Drawing.Graphics DrawEllipse
Line System.Drawing.Graphics DrawLine
Atn System.Math Atan
Sgn System.Math Sign
Sqr System.Math Sqrt
Lset System.String PadRight
Rset System.String PadLeft
Rnd Microsoft.VisualBasic.Compatibility.VB6 Rnd
Round Microsoft.VisualBasic.Compatibility.VB6 Round
DoEvents System.Winform.Application DoEvents
VarType System.Object GetType (returns an
object of class Type,
which has properties to
get information.
The Set command is no longer supported. That means
Set objObject = objAnotherObject
becomes:
objObject = objAnotherObject
The Debug command changes from.
Debug.Print
to:
Debug.Write
Debug.WriteLine
 Array:-
In VB6 declaring an array
Dim Items(5) As String
Gives you 6 items from index 0 to index 5. In VB.NET, this same declaration will yield 5
elements from index 0 through index 4. Be on the look out for "out of bounds" type errors. Also,
all arrays in .NET must now be zero-based.
 Default Properties:-
VB6 allows you to reference the default property of a control or object without specifying the
name of the property. VB.NET disallows this.
txtMyText = "Hello"
rst!("name") = "Dave"
rst!name = "Dave"
The above statements must be replaced with:
txtMyText.text = "Hello"
rst!("name").value = "Dave"
rst!name.value = "Dave"
 References to Form Controls:-
Controls on a form are no longer public in VB.NET. Thus, form2 cannot reference
form1.text1.text. What you now need to do is add public Let and Get property procedures to the
form for each control property you want to reference from another form. By the way, Let is no
longer supported, read on for more info.
You can also declare the control you want to reference as Public Shared but that is not the
recommended approach.
 VB Integrated Development Environment:-
The VB Integrated Development Environment (IDE) is now fully integrated with the Visual
Studio.NET IDE. Thus VB.NET has a new language-neutral extensibility model. VB.NET add-ins
are now VS.NET add-ins. While this lets you create a VB.NET add-in that changes a Visual C#
form, your existing add-ins need to change to reflect the new extensibility model.
 Parameters:-
Parameters can be passed to a procedure in one of two ways. Either by reference (ByRef) or by
value (ByVal). When you use the by reference method, changes made to parameters' values in a
sub procedure are known when control returns back to the calling procedure.
ByRef is the default method of parameter passing in VB6 and prior versions when the
parameter's data type is an intrinsic one such as Integer, Long, Boolean, String, etc.
Then second method is pass by value (ByVal). This is the default for all non-intrinsic data types.
When passed by value, the calling procedure knows nothing about changes made to the
parameter's value in a sub procedure.
VB.NET passes all parameters ByVal. Thus, don't rely on the default behavior and always
explicitly specify ByVal or ByRef in your parameter lists.
• Similarity between java and .NET:-
Similarities
 Both multi-tiered, similar computing technologies
 Both support “standards”
 Both offer different tools & ways to achieve the same goal.
 A lot of parallelism can be seen.
 Very difficult to compare and qualify the comparison because each has its own
advantages & disadvantages.
Microsoft .Net vs. J2EE Comparison Language:-
 C# and Java both derive from C and C++.
 MS says: “C# combines the power of VC++ with the ease of usage of VB”
 Significant features include garbage collection, hierarchical namespaces) are present in both.
 Different Syntax but same result.
 Java runs on any platform with a Java VM. C# only runs in Windows for the foreseeable future.
Unit-01/Lecture-06
Architecture of .Net, Three Tier Architecture
Architecture of .Net:- [RGPV/June2011]
Common Language Runtime (CLR): The heart of the .Net Framework. It is also called
the .Net runtime. It resides above the operating system and handles all .Net applications. It
handles garbage collection, Code Access Security (CAS) etc.
1. Microsoft Intermediate Language (MSIL) Code: When we compile our .Net code then it
is not directly converted to native/binary code; it is first converted into intermediate
code known as MSIL code which is then interpreted by the CLR. MSIL is independent of
hardware and the operating system. Cross language relationships are possible since
MSIL is the same for all .Net languages. MSIL is further converted into native code.
2. Just in Time Compilers (JIT): It compiles IL code into native executable code (exe or dlls).
Once code is converted to IL then it can be called again by JIT instead of recompiling that
code.
3. Framework class library: The .Net Framework provides a huge class library called FCL for
common tasks. It contains thousands of classes to access Windows APIs and common
functions like string manipulations, Data structures, stream, IO, thread, security etc.
4. Common Language Specification (CLS): What makes a language to be .Net compliant?
Answer is CLS. Microsoft has defined some specifications that each .Net language has to
follow. For e.g.: no pointer, no multiple inheritances etc.
5. Common Type System (CTS): CTS defines some basic data types that IL can understand.
Each .Net compliant language should map its data types to these standard data types.
This makes it possible for two .Net compliant languages to communicate by
passing/receiving parameters to and from each other. For example CTS defines Int32 for
C# int and VB integer data types.
Three Tier Architecture:- [RGPV/Dec2009]
This article explains how to create and implement a 3-tier architecture for our project in
ASP.Net.
What is a Layer?
A layer is a reusable portion of code that performs a specific function. In the .NET environment,
a layer is usually set up as a project that represents this specific function. This specific layer is in
charge of working with other layers to perform some specific goal.Let’s briefly look at the latter
situation first.
Data Layer:-
A DAL contains methods that help the Business Layer to connect the data and perform required
actions, whether to return data or to manipulate data (insert, update, delete and so on).
Business Layer:-
A BAL contains business logic, validations or calculations related to the data.Though a web site
could talk to the data access layer directly, it usually goes through another layer called the
Business Layer. The Business Layer is vital in that it validates the input conditions before calling
a method from the data layer. This ensures the data input is correct before proceeding, and can
often ensure that the outputs are correct as well. This validation of input is called business
rules, meaning the rules that the Business Layer uses to make “judgments” about the data.
Presentation Layer:-
The Presentation Layer contains pages like .aspx or Windows Forms forms where data is
presented to the user or input is taken from the user. The ASP.NET web site or Windows Forms
application (the UI for the project) is called the Presentation Layer. The Presentation Layer is
the most important layer simply because it’s the one that everyone sees and uses. Even with a
well structured business and data layer, if the Presentation Layer is designed poorly, this gives
the users a poor view of the system.
Advantages of a Three-Tier Architecture:-
The main characteristic of a Host Architecture is that the application and databases reside on
the same host computer and the user interacts with the host using an unfriendly dumb
terminal. This architecture does not support distributed computing (the host applications are
unable to connect to a database of a strategically allied partner). Some managers find that
developing a host application takes too long and it is expensive. These disadvantages
consequently led to a Client-Server architecture.
A Client-Server architecture is a 2-Tier architecture because the client does not distinguish
between Presentation Layer and Business Layer. The increasing demands on GUI controls
caused difficulty in managing the mixture of source code from a GUI and the Business Logic
(Spaghetti Code). Further, the Client Server Architecture does not support enough the Change
Management. Let us suppose that the government increases the Entertainment tax rate from
4% to 8 %, then in the Client-Server case, we need to send an update to each client and they
must update synchronously on a specific time otherwise we may store invalid or incorrect
information. The Client-Server Architecture is also a burden to network traffic and resources.
Let us assume that about five hundred clients are working on a data server. Then we will have
five hundred ODBC connections and several ruffian record sets that must be transported from
the server to the clients (because the Business Layer remains in the client side). The fact that
Client-Server does not have any caching facilities like in ASP.NET causes additional traffic in the
network. Normally, a server has better hardware than the client, therefore it is able to compute
algorithms faster than a client, so this fact is also an additional argument in favor of the 3-Tier
Architecture. This categorization of the application makes the function more reusable easily and
it becomes too easy to find the functions that have been written previously. If a programmer
wants to make further updates in the application then he can easily understand the previous
written code and can update it easily.
UNIT 1/LECTURE -07
Understanding assemblies, Roles of assemblies, executable code
Introduction of Assemblies:-[RGPV/Dec2010,Dec2011,Dec2013]
Assemblies are the building blocks of .NET Framework applications; they form the fundamental
unit of deployment, version control, reuse, activation scoping, and security permissions. An
assembly is a collection of types and resources that are built to work together and form a logical
S.NO RGPV QUESTIONS Year Marks
Q.1 Explain the three tier architecture in .NET. Dec2009 10
Q.2 Explain the briefly architecture of .NET. Dec2011 05
unit of functionality. An assembly provides the common language runtime with the information
it needs to be aware of type implementations. To the runtime, a type does not exist outside the
context of an assembly.
An assembly performs the following functions:
• It contains code that the common language runtime executes. Microsoft intermediate
language (MSIL) code in a portable executable (PE) file will not be executed if it does not
have an associated assembly manifest. Note that each assembly can have only one entry
point (that is, DllMain, WinMain, or Main).
• It forms a security boundary. An assembly is the unit at which permissions are requested
and granted. For more information about security boundaries as they apply to
assemblies, see Assembly Security Considerations.
• It forms a type boundary. Every type's identity includes the name of the assembly in
which it resides. A type called MyType that is loaded in the scope of one assembly is not
the same as a type called MyType that is loaded in the scope of another assembly.
• It forms a reference scope boundary. The assembly's manifest contains assembly
metadata that is used for resolving types and satisfying resource requests. It specifies
the types and resources that are exposed outside the assembly. The manifest also
enumerates other assemblies on which it depends.
• It forms a version boundary. The assembly is the smallest versionable unit in the
common language runtime; all types and resources in the same assembly are versioned
as a unit. The assembly's manifest describes the version dependencies you specify for
any dependent assemblies. For more information about versioning, see Assembly
Versioning.
• It forms a deployment unit. When an application starts, only the assemblies that the
application initially calls must be present. Other assemblies, such as localization
resources or assemblies containing utility classes, can be retrieved on demand. This
allows applications to be kept simple and thin when first downloaded. For more
information about deploying assemblies, see Deploying Applications.
• It is the unit at which side-by-side execution is supported. For more information about
running multiple versions of an assembly, see Assemblies and Side-by-Side Execution.
Assemblies can be static or dynamic. Static assemblies can include .NET Framework types
(interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource
files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can
also use the .NET Framework to create dynamic assemblies, which are run directly from
memory and are not saved to disk before execution. You can save dynamic assemblies to disk
after they have executed.
There are several ways to create assemblies. You can use development tools, such as Visual
Studio, that you have used in the past to create .dll or .exe files. You can use tools provided in
the Windows Software Development Kit (SDK) to create assemblies with modules created in
other development environments. You can also use common language runtime APIs, such as
Reflection.Emit, to create dynamic assemblies.
An assembly is the primary building block of a .NET Framework application. It is a collection of
functionality that is built, versioned, and deployed as a single implementation unit (as one or
more files). All managed types and resources are marked either as accessible only within their
implementation unit, or as accessible by code outside that unit. .NET Assembly contains all the
metadata about the modules, types, and other elements it contains in the form of a manifest.
The CLR loves assemblies because differing programming languages are just perfect for creating
certain kinds of applications. For example, COBOL stands for Common Business-Oriented
Language because it’s tailor-made for creating business apps. However, it’s not much good for
creating drafting programs. Regardless of what language you used to create your modules, they
can all work together within one Portable Executable Assembly. There’s a hierarchy to the
structure of .NET code. That hierarchy is Assembly - > Module -> Type -> Method." Assemblies
can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and
classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on).
Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET
Framework to create dynamic assemblies, which are run directly from memory and are not
saved to disk before execution. You can save dynamic assemblies to disk after they have
executed.
Assembly Benefits:-
Assemblies are designed to simplify application deployment and to solve versioning
problems that can occur with component-based applications.
End users and developers are familiar with versioning and deployment issues that arise from
today's component-based systems. Some end users have experienced the frustration of
installing a new application on their computer, only to find that an existing application has
suddenly stopped working. Many developers have spent countless hours trying to keep all
necessary registry entries consistent in order to activate a COM class.
Many deployment problems have been solved by the use of assemblies in the .NET Framework.
Because they are self-describing components that have no dependencies on registry entries,
assemblies enable zero-impact application installation. They also simplify uninstalling and
replicating applications.
Assemblies are of two types:
1. Private Assemblies:-
The assembly is intended only for one application. The files of that assembly must be placed in
the same folder as the application or in a sub folder. No other application will be able to make a
call to this assembly. The advantage of having a private assembly is that, it makes naming the
assembly very easy, since the developer need not worry about name clashes with other
assemblies. As long as the assembly has a unique name within the concerned application, there
won't be any problem.
2. Shared Assemblies:-
If the assembly is to be made into a Shared Assembly, then the naming conventions are very
strict since it has to be unique across the entire system. The naming conventions should also
take care of newer versions of the component being shipped. These are accomplished by giving
the assembly a Shared Name. Then the assembly is placed in the global assembly cache, which
is a folder in the file system reserved for shared assemblies.
Difference between a namespace and assembly name:-
A namespace is a logical naming scheme for types in which a simple type name, such as My
Type, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely
under control of the developer. For example, types MyCompany.FileAccess.A and
MyCompany.FileAccess.B might be logically expected to have functionally related to file access.
The .NET Framework uses a hierarchical naming scheme for grouping types into logical
categories of related functionality, such as the ASP.NET application framework, or remoting
functionality. Design tools can make use of namespaces to make it easier for developers to
browse and reference types in their code. The concept of a namespace is not related to that of
an assembly. A single assembly may contain types whose hierarchical names have different
namespace roots, and a logical namespace root may span multiple assemblies. In the .NET
Framework, a namespace is a logical design-time naming convenience, whereas an assembly
establishes the name scope for types at run time.
 Executable code:-
Software in a form that can be run in the computer. It typically refers to machine language,
which is the set of native instructions the computer carries out in hardware. Executable files in
the DOS/Windows world use .EXE and .COM file extensions, while executable files in Unix and
Mac do not require specific extensions. They are identified by their file structure.
The Portable Executable (PE) format is a file format for executables, object code, DLLs, FON
Font files,[1][2]
and others used in 32-bit and 64-bit versions of Windows operating systems. The
PE format is a data structure that encapsulates the information necessary for the Windows OS
loader to manage the wrapped executable code. This includes dynamic library references for
linking, API export and import tables, resource management data and thread-local storage (TLS)
data. On NT operating systems, the PE format is used for EXE, DLL, SYS (device driver), and
other file types. The Extensible Firmware Interface (EFI) specification states that PE is the
standard executable format in EFI environments.
PE is a modified version of the Unix COFF (Common Object File Format). PE/COFF is an
alternative term in Windows development.
A PE file consists of a number of headers and sections that tell the dynamic linker how to map
the file into memory. An executable image consists of several different regions, each of which
requires different memory protection; so the start of each section must be aligned to a page
boundary. For instance, typically the .text section (which holds program code) is mapped as
execute/readonly, and the .data section (holding global variables) is mapped as no-
execute/readwrite. However, to avoid wasting space, the different sections are not page
aligned on disk. Part of the job of the dynamic linker is to map each section to memory
individually and assign the correct permissions to the resulting regions, according to the
instructions found in the headers.
 Reflection:-
The classes in the System. Reflection namespace, together with System. Type, enable you to
obtain information about loaded assemblies and the types defined within them, such as classes,
interfaces, and value types. You can also use reflection to create type instances at run time, and
to invoke and access them. For topics about specific aspects of reflection, see Related Topics at
the end of this overview.
The common language runtime loader manages application domains, which constitute defined
boundaries around objects that have the same application scope. Assemblies contain modules,
modules contain types, and types contain members. Reflection provides objects that
encapsulate assemblies, modules, and types. You can use reflection to dynamically create an
instance of a type, bind the type to an existing object, or get the type from an existing object.
You can then invoke the type's methods or access its fields and properties. Typical uses of
reflection include the following:
• Use Assembly to define and load assemblies, load modules that are listed in the
assembly manifest, and locate a type from this assembly and create an instance of it.
• Use Module to discover information such as the assembly that contains the module and
the classes in the module. You can also get all global methods or other specific,
nonglobal methods defined on the module.
• Use ConstructorInfo to discover information such as the name, parameters, access
modifiers (such as public or private), and implementation details (such as abstract or
virtual) of a constructor. Use the GetConstructors or GetConstructor method of a Type
to invoke a specific constructor.
• Use FieldInfo to discover information such as the name, access modifiers (such as public
or private) and implementation details (such as static) of a field, and to get or set field
values.
• Use EventInfo to discover information such as the name, event-handler data type,
custom attributes, declaring type, and reflected type of an event, and to add or remove
event handlers.
• Use PropertyInfo to discover information such as the name, data type, declaring type,
reflected type, and read-only or writable status of a property, and to get or set property
values.
• Use ParameterInfo to discover information such as a parameter's name, data type,
whether a parameter is an input or output parameter, and the position of the
parameter in a method signature.
The classes of the System.Reflection.Emit namespace provide a specialized form of reflection
that enables you to build types at run time.
Reflection can also be used to create applications called type browsers, which enable users to
select types and then view the information about those types.
S.NO RGPV QUESTION YEAR MARKS
Q.1 What is meant by assembly? Write its
importance and role.
Dec2013 07
Q.2 Explain Assembly with their nature and role. Dec2011 10
Q.3 Write short notes on the Following: DEC 2010 5
Assemblies and class libraries.
UNIT 1/LECTURE-08
Manifest,Metadata,Manage code and Manage data
Manifest:-
An assembly manifest contains all the metadata needed to specify the assembly's version
requirements and security identity, and all metadata needed to define the scope of the
assembly and resolve references to resources and classes. The assembly manifest can be
stored in either a PE (Portable Executable) file (an .exe or .dll) with Microsoft intermediate
language (MSIL) code or in a standalone PE (Portable Executable) file that contains only
assembly manifest information. The following table shows the information contained in the
assembly manifest. The first four items the assembly name, version number, culture, and
strong name information make up the assembly's identity.
Assembly name: A text string specifying the assembly's name.
Version number: A major and minor version number, and a revision and build number. The
common language runtime uses these numbers to enforce version policy.
Culture: Information on the culture or language the assembly supports. This information
should be used only to designate an assembly as a satellite assembly containing culture- or
language-specific information. (An assembly with culture information is automatically
assumed to be a satellite assembly.) Strong name information: The public key from the
publisher if the assembly has been given a strong name. List of all files in the assembly:
A hash of each file contained in the assembly and a file name. Note that all files that make up
the assembly must be in the same directory as the file containing the assembly manifest.
Type reference information: Information used by the runtime to map a type reference to the
file that contains its declaration and implementation. This is used for types that are
exportedfrom the assembly.
Information on referenced assemblies: A list of other assemblies that are statically referenced
by the assembly. Each reference includes the dependent assembly's name, assembly
metadata (version, culture, operating system, and so on), and public key, if the assembly is
strong named.
Every assembly, whether static or dynamic, contains a collection of data that describes how
the elements in the assembly relate to each other. The assembly manifest contains this
assembly metadata. An assembly manifest contains all the metadata needed to specify the
assembly's version requirements and security identity, and all metadata needed to define the
scope of the assembly and resolve references to resources and classes. The assembly
manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate
language (MSIL) code or in a standalone PE file that contains only assembly manifest
information.
Metadata:-
Metadata is information about a PE. In COM, metadata is communicated through non-
standardized type libraries.
In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain
guidelines;
it contains information such as the assembly’s name, version, language (spoken, not
computera.k.a., culture), what external types are referenced, what internal types are exposed,
methods, properties, classes, and much more.
The CLR uses metadata for a number of specific purposes. Security is managed through a public
key in the PE’s header.
Information about classes, modules, and so forth allows the CLR to know in advance what
structures are necessary. The class loader component of the CLR uses metadata to locate
specific classes within assemblies, either locally or across networks.
Just-in-time (JIT) compilers use the metadata to turn IL into executable code.
Other programs take advantage of metadata as well.
A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the
document file has completed comments, author, title, or other Properties metadata, the text is
displayed as a tool tip when a user hovers the mouse over the document on the desktop. You
can use the Ildasm.exe utility to view the metadata in a PE. Literally, this tool is an IL
disassembler.
Metadata in .Net is binary information which describes the characteristics of a resource . This
information include Description of the Assembly , Data Types and members with their
declarations and implementations, references to other types and members , Security
permissions etc. A module's metadata contains everything that needed to interact with
another module.
During the compile time Metadata created with Microsoft Intermediate Language (MSIL) and
stored in a file called a Manifest. Both Metadata and Microsoft Intermediate Language (MSIL)
together wrapped in a Portable Executable (PE) file. During the runtime of a program Just In
Time (JIT) compiler of the Common Language Runtime (CLR) uses the Metadata and converts
Microsoft Intermediate Language (MSIL) into native code. When code is executed, the
runtime loads metadata into memory and references it to discover information about your
code's classes, members, inheritance, and so on. Moreover Metadata eliminating the need for
Interface Definition Language (IDL) files, header files, or any external method of component
reference.
Manage code and Manage data:-
Managed code is code that is written to target the services of the Common Language
Runtime. In order to target these services, the code must provide a minimum level of
information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is
managed by default. Visual Studio .NET C++ code is not managed by default, but the
compiler can produce managed code by specifying a command-line switch (/CLR). Closely
related to managed code is managed data--data that is allocated and de- allocated by the
Common Language Runtime's garbage collector. C#, Visual Basic, and JScript .NET data is
managed by default.
Managed Code in Microsoft .Net Framework, is the code that has executed by the Common
Language Runtime (CLR) environment. On the other hand Unmanaged Code is directly
executed by the computer's CPU. Data types, error-handling mechanisms, creation and
destruction rules, and design guidelines vary between managed and unmanaged object
models.
The benefits of Managed Code include programmers convenience and enhanced security .
Managed code is designed to be more reliable and robust than unmanaged code , examples
are Garbage Collection , Type Safety etc. The Managed Code running in a Common
Language Runtime (CLR) cannot be accessed outside the runtime environment as well as
cannot call directly from outside the runtime environment. This makes the programs more
isolated and at the same time computers are more secure . Unmanaged Code can bypass
the .NET Framework and make direct calls to the Operating System. Calling unmanaged
code presents a major security risk.
S.NO RGPV QUESTION YEAR MARKS
Q.1 Write short notes on the following:
Metadata
Dec2011 4
UNIT 1/LECTURE-09
.NET Security Model: [RGPV/Dec2013,Dec2011,Dec2010]
Introduction
When I was first faced with the .NET Framework security and cryptography fist, I noticed that
most of the quick-start articles sufferes from lots of low-level details and explanations of the
nuts and bolts of .NET Framework Security.
But for the first time, I needed a brief, easy to understand and remember tutorial, instead. So,
actually this is not an article. This is rather a bird's-eye overview of the .NET Framework security
model, with visual illustrations.
Security concepts
You can implement the security model in your applications in a declarative and/or an
imperative way. In most cases, you should prefer declarative security, and implement the
security model only when some application security issues can be known only at runtime.
Sample of declarative security:
[assembly : FileDialogPermissionAttribute(
SecurityAction.RequestMinimum,
Unrestricted=true)]
Sample of imperative security:
FileDialogPermission fileDlgPermission = new
FileDialogPermission(PermissionState.Unrestricted);
fileDlgPermission.Demand();
if (myDlgForm.ShowDialog() == DialogResult.OK)
MessageBox.Show(myDlgForm.FileName);
.NET Framework Security Model:-
Code Access Security (CAS)
Permissions
Code groups
CLR examines all code groups in the hierarchy. When the code group is marked as Exclusive,
then the CLR stops checking for group membership. Next, the CLR determines the permission
sets for each code group. If the code is a member of the code group that is marked as Exclusive,
only the permission set of that code group is taken into account, otherwise the CLR calculates
the permission as a Union of all permission sets of all code groups that the running code is a
member of.
S.NO RGPV QUESTION YEAR MARKS
Q.1 What do you mean by .NET
Security model?
Dec2011 10
Q.2 Explain security model in .NET. DEC2010 10
Q.3 Describe briefly the .NET security
model.
Dec2013 03
Mca 504 dotnet_unit1

Weitere ähnliche Inhalte

Was ist angesagt?

Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01
Niit Care
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
Prashanth Shivakumar
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
Mir Majid
 
.Net framework
.Net framework.Net framework
.Net framework
Arun Pal
 
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRTITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp
 
Vb net xp_01
Vb net xp_01Vb net xp_01
Vb net xp_01
Niit Care
 

Was ist angesagt? (19)

Vb.net session 01
Vb.net session 01Vb.net session 01
Vb.net session 01
 
VB.Net GUI Unit_01
VB.Net GUI Unit_01VB.Net GUI Unit_01
VB.Net GUI Unit_01
 
Dot net Introduction and their usabilities
Dot net Introduction and  their usabilitiesDot net Introduction and  their usabilities
Dot net Introduction and their usabilities
 
ASP.Net Technologies Part-2
ASP.Net Technologies Part-2ASP.Net Technologies Part-2
ASP.Net Technologies Part-2
 
Net framework
Net frameworkNet framework
Net framework
 
Visual programming
Visual programmingVisual programming
Visual programming
 
C# chap 2
C# chap 2C# chap 2
C# chap 2
 
.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions.Net introduction by Quontra Solutions
.Net introduction by Quontra Solutions
 
.Net framework interview questions
.Net framework interview questions.Net framework interview questions
.Net framework interview questions
 
.Net framework
.Net framework.Net framework
.Net framework
 
Asp.net new
Asp.net newAsp.net new
Asp.net new
 
Visual Basic User Interface-III
Visual Basic User Interface-IIIVisual Basic User Interface-III
Visual Basic User Interface-III
 
6.origins genesis of .net technology
6.origins genesis of .net technology6.origins genesis of .net technology
6.origins genesis of .net technology
 
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRTITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
ITCamp 2012 - Raffaele Rialdi - Introduction to WinRT
 
Vb net xp_01
Vb net xp_01Vb net xp_01
Vb net xp_01
 
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for DevelopersMSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
MSDN Presents: Visual Studio 2010, .NET 4, SharePoint 2010 for Developers
 
Windows programming ppt
Windows programming pptWindows programming ppt
Windows programming ppt
 
Chapter 01 Introduction to Visual Basic
Chapter 01 Introduction to Visual BasicChapter 01 Introduction to Visual Basic
Chapter 01 Introduction to Visual Basic
 
DOTNET
DOTNETDOTNET
DOTNET
 

Ähnlich wie Mca 504 dotnet_unit1

.Net framework
.Net framework.Net framework
.Net framework
Raghu nath
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checker
Yesu Raj
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
SIVAJISADHANA
 
Net framework
Net frameworkNet framework
Net framework
Arun Pal
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
Yesu Raj
 

Ähnlich wie Mca 504 dotnet_unit1 (20)

.Net framework
.Net framework.Net framework
.Net framework
 
dotNET frameworks
dotNET frameworksdotNET frameworks
dotNET frameworks
 
The Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.NetThe Seven Pillars Of Asp.Net
The Seven Pillars Of Asp.Net
 
Unit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdfUnit I- Introduction to .NET Framework.pdf
Unit I- Introduction to .NET Framework.pdf
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Dot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part iDot net-interview-questions-and-answers part i
Dot net-interview-questions-and-answers part i
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
Automatic answer checker
Automatic answer checkerAutomatic answer checker
Automatic answer checker
 
Chapter1
Chapter1Chapter1
Chapter1
 
1-.NET Introduction.pptx
1-.NET Introduction.pptx1-.NET Introduction.pptx
1-.NET Introduction.pptx
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
New microsoft office word document
New microsoft office word documentNew microsoft office word document
New microsoft office word document
 
Introduction to .net
Introduction to .netIntroduction to .net
Introduction to .net
 
introduction to .net
introduction to .netintroduction to .net
introduction to .net
 
Net framework
Net frameworkNet framework
Net framework
 
Session i
Session iSession i
Session i
 
Unit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdfUnit -II Introduction to visual programming.pdf
Unit -II Introduction to visual programming.pdf
 
Dotnet Basics Presentation
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
 
Online advertising management system
Online advertising management systemOnline advertising management system
Online advertising management system
 

Mehr von Rai Saheb Bhanwar Singh College Nasrullaganj

Mehr von Rai Saheb Bhanwar Singh College Nasrullaganj (20)

lec34.ppt
lec34.pptlec34.ppt
lec34.ppt
 
lec33.ppt
lec33.pptlec33.ppt
lec33.ppt
 
lec31.ppt
lec31.pptlec31.ppt
lec31.ppt
 
lec32.ppt
lec32.pptlec32.ppt
lec32.ppt
 
lec42.ppt
lec42.pptlec42.ppt
lec42.ppt
 
lec41.ppt
lec41.pptlec41.ppt
lec41.ppt
 
lec39.ppt
lec39.pptlec39.ppt
lec39.ppt
 
lec38.ppt
lec38.pptlec38.ppt
lec38.ppt
 
lec37.ppt
lec37.pptlec37.ppt
lec37.ppt
 
lec23.ppt
lec23.pptlec23.ppt
lec23.ppt
 
lec21.ppt
lec21.pptlec21.ppt
lec21.ppt
 
lec20.ppt
lec20.pptlec20.ppt
lec20.ppt
 
lec19.ppt
lec19.pptlec19.ppt
lec19.ppt
 
lec18.ppt
lec18.pptlec18.ppt
lec18.ppt
 
lec17.ppt
lec17.pptlec17.ppt
lec17.ppt
 
lec16.ppt
lec16.pptlec16.ppt
lec16.ppt
 
lec30.ppt
lec30.pptlec30.ppt
lec30.ppt
 
lec28.ppt
lec28.pptlec28.ppt
lec28.ppt
 
lec27.ppt
lec27.pptlec27.ppt
lec27.ppt
 
lec26.ppt
lec26.pptlec26.ppt
lec26.ppt
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Mca 504 dotnet_unit1

  • 1. UNIT – 1 Unit-01/Lecture-01 Introduction to .NET Technology Introduction DOT NET TECHNOLOGY: [RGPV/June2009] The .NET platform is an integral component of the Microsoft Windows operating system for building and running next generation software applications and Web services. The .NET development framework provides a new and simplified model for programming and deploying applications on the Windows platform. It provides such advantages as multiplatform applications, automatic resource management, and simplification of application deployment. As security is an essential part of .NET, it provides security support, such as code authenticity check, resources access authorizations, declarative and imperative security, and cryptographic security methods for embedding into the user’s application. . .NET provides a simple object-oriented model to access most of the Windows application programming interfaces (APIs). It also provides mechanisms by which you can use the existing native code. In addition, it significantly extends the development platform by providing tools and technologies to develop Internet-based distributed applications Microsoft started development of .NET Framework in the late 1990s, originally under the name of Next Generation Windows Services (NGWS). By late 2000, the first beta versions of .NET 1.0 were released. Version 3.0 of .NET Framework is included with Windows Server 2008 and Windows Vista. Version 3.5 is included with Windows 7 and Windows Server 2008 R2, and can also be installed on Windows XP and Windows Server 2003.[2] On 12 April 2010, .NET Framework 4 was released alongside Visual Studio 2010.
  • 2. Unit-01/Lecture-02 Introduction to VB.NET Introduction to VB.NET: [RGPV/June2010] Visual Basic .NET (VB.NET) is a multi-paradigm, high level programming language, implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language. Along with Visual C#, it is one of the two main languages targeting the .NET framework. Microsoft currently supplies two main editions of IDE for developing in VB.NET: Microsoft Visual Studio 2013, which is commercial software and Visual Studio Express Edition 2013, which is free of charge. The command-line compiler, VBC.EXE, is installed as part of the freeware .NET Framework SDK. Mono also includes a command-line VB.NET compiler. VISUAL BASIC is a high level programming language which evolved from the earlier DOS version called BASIC. BASIC means Beginners' All-purpose Symbolic Instruction Code. It is a very easy programming language to learn. The code look a lot like English Language. Different software companies produced different versions of BASIC, such as Microsoft QBASIC, QUICKBASIC, GWBASIC, IBM BASICA and so on. Now, there are many versions of VB exist in the market, the most popular one and still widely used by many VB programmers is none other than Visual Basic 6. We also have VB.net, VB2005, VB2008. VISUAL BASIC is a VISUAL and events driven Programming Language. These are the main divergence from the old BASIC. In BASIC, programming is done in a text-only environment and the program is executed sequentially. In VB, programming is done in a graphical environment. In the old BASIC, you have to write program code for each graphical object you wish to display it on screen, including its position and its color. However, In VB , you just need to drag and drop any graphical object anywhere on the form, and you can change its color any time using the properties windows. On the other hand, because the user may click on certain object randomly, so each object has to be programmed independently to be able to response to those actions (events). Therefore, a VB Program is made up of many subprograms, each has its own program code, and each can be executed independently and at the same time each can be linked together in one way or another. Example: simple program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a default form with the name Form1 will be available for you to start your new
  • 3. project. Now, double click on Form1, the source code window for Form1 as shown the top of the source code window consists of a list of objects and their associated events or procedures. the object displayed is Form and the associated procedure is Load. VB.NET has the following syntax: • Statements can terminate with keywords such as "End If", instead of using "{}"s to group statements. • Statements can also be terminated with a new line, instead of semicolons. • Variables are both assigned and compared using an equals sign. • Round brackets are used with arrays, both to declare them and to get a value at a given index in one of them. The following is a very simple VB.NET program, a version of the classic "Hello world" example created as a console application: Module Module1 Sub Main() Console.WriteLine ("Hello, world!")
  • 4. End Sub End Module Features of VB.NET: [ RGPV/june2009,June2010,Dec2012] Interoperability:- Because computer systems commonly require interaction between newer and older applications, .NET Framework provides means to access functionality implemented in newer and older programs that execute outside .NET environment. Access to COM components is provided in the System.Runtime.Interop Services and System. Enterprise Services namespaces of the framework; access to other functionality is achieved using the P/Invoke feature. Common Language Runtime engine:- The Common Language Runtime (CLR) serves as the execution engine of .NET Framework. All .NET programs execute under the supervision of the CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and exception handling. Language independence:- .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all possible data types and programming constructs supported by the CLR and how they may or may not interact with each other conforming to the Common Language Infrastructure (CLI) specification. Because of this feature, .NET Framework supports the exchange of types and object instances between libraries and applications written using any conforming .NET language. Framework Class Library:- The Framework Class Library (FCL) is a library of functionality available to all languages using .NET Framework. The FCL provides classes that encapsulate a number of common functions, including file reading and writing, graphic rendering, database interaction, XML document manipulation, and so on. It consists of classes, interfaces of reusable types that integrates with CLR (Common Language Runtime).
  • 5. Simplified deployment:- .NET Framework includes design features and tools which help manage the installation of computer software to ensure it does not interfere with previously installed software, and it conforms to security requirements. Security:- The design addresses some of the vulnerabilities, such as buffer overflows, which have been exploited by malicious software. Additionally, .NET provides a common security model for all applications. Portability:- While Microsoft has never implemented the full framework on any system except Microsoft Windows, it has engineered the framework to be platform-agnostic and cross-platform implementations are available for other operating systems . Microsoft submitted the specifications for the Common Language Infrastructure (which includes the core class libraries, Common Type System, and the Common Intermediate Language). Memory management:- .NET Framework CLR frees the developer from the burden of managing memory (allocating and freeing up when done); it handles memory management itself by detecting when memory can be safely freed. Instantiations of .NET types (objects) are allocated from the managed heap; a pool of memory managed by the CLR. As long as there exists a reference to an object, which might be either a direct reference to an object or via a graph of objects, the object is considered to be in use. When there is no reference to an object, and it cannot be reached or used, it becomes garbage, eligible for collection. .
  • 6. Unit-01/Lecture-03 Software development and Visual Basic .NET and versions Software development:- Software engineering is not easy to define; indeed, many argue that it is not a form of engineering at all and that its designers are not really engineers. But software developers are engineers and include in their ranks many professionals with formal training and experience. According to Webster's dictionary, engineering is the application of mathematical and scientific principles to practical ends, as the design, construction, and operation of efficient structures, equipment, and systems. The software industry emerged in the mid−20th century with the advent of the modern computer and has progressed through three distinct "ages" since then:  The Procedure−Oriented Age: Procedure−oriented programming was largely concerned with computational results rather than data the focus being on procedures, or just code, as islands of functionality. Software systems were not organized in any meaningful structure and were merely collections of files containing huge functions and procedures that were processed as required fordiscrete calculations. Data was external to the functional black box and easily accessible because it was global. Because the systems were fixated on a result, a value, they could be S.NO RGPV QUESTIONS Year Marks Q.1 What are the benefits of .NET framework? Dec2013 04 Q.2 Discuss the features of .NET technology. Dec2012 07 Q.3 Briefly describe the VB.NET and also explain the features of VB.NET. June2010 10 Q.4 What are the Features of .NET? Explain CTS. June2009 10
  • 7. adequately managed by the very dedicated individuals that wrote them.  The Structure−Oriented Age As software systems grew, programmers needed to manage and maintain them more efficiently. The structure−oriented age introduced a paradigm in which the functions were organized in structures a module containing procedures and data. In other words, the unit or level of abstraction became the module rather than the individual procedure. Structural programming lends itself to encapsulation, data−centric programming, collections of like routines, and object−like programming.  The Object−Oriented Age By the end of the 1960s it became apparent that the ever−growing complexity of software systems would necessitate a new model, one that was more humanly Manageable and comprehensible. Now almost half a century after the first object−oriented software language, Simula, was created, the OO age has finally taken hold in response to this complexity. OO lets us model and design software systems around familiar concepts (objects) behind which complexity is hidden through abstraction, much like the abstraction found in nature. The focus of programming is mostly on attributes and data rather than computations or calculations. Encapsulation and other features have been refined, and continue to be refined, to better serve the OO model. The Classic Programming Models:- • Structured Programming:- Structured programming (sometimes known as modular programming) is a subset of procedural programming that enforces a logical structure on the program being written to make it more efficient and easier to understand and modify. Certain languages such as Ada, Pascal, and dBASE are designed with features that encourage or enforce a logical program structure. Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or set of similar functions is coded in a separate module or submodule, which means that code can be loaded into memory more efficiently and that modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure. Program flow follows a simple hierarchical model that employs looping constructs such as "for," "repeat," and "while." Use of the "Go To" statement is discouraged.
  • 8. Bug−Reduced Code:- The boundaries of buggy code are within the confines of a module, which is usually the responsibility of one programmer. It is much easier to detect a bug in a module through isolation than in a file containing a single mega−procedure. Once the bugs are dispatched from the modules, the pest−free code can then be reused in other parts of the application. Divide and Conquer:- The strongest Roman emperors realized that the solution to conquering their enemies was to divide the armies of resisters and then conquer the smaller units. Modern analytical problem− solving techniques teach the same approach, as do many successful algorithm masters. The best way to solve a problem is to restate it in as many ways as you possibly can; this helps identify the "real" problem, which you then break down into smaller components. Reuse:- Contrary to what many OO purists claim, reuse became the battle cry of software professionals long before the rise of object−orientation. The idea even predates the industrial revolution, which heralded the effort to make better products through faster and cheaper means. • Object−Based Programming:- As structured programming methods became more refined, it became apparent to the engineers that modules of code could be related to as objects. Many languages gradually become more object−based, especially as compilers emerged that could enforce encapsulation and cater to the compiling, linking, and binding of numerous modules into complete applications. A good example of object−based programming plots the transformation of C into C++. Today C+ + is what you would call a hybrid language because it allows you to code standard C modules, to add objects and do object−based programming, or to invoke the object−oriented features of the language such as inheritance and Polymorphism. Object−Oriented Software Development:- 1. A "pure" or "true" object−oriented language thus comprises the following traits: Modularity is achieved in modules called classes, the unit of encapsulation. 2. Related classes are grouped in hierarchies. The classes are related by descent Inheritance. 3. The classes can be instantiated at runtime as objects, and their functionality and data dynamically accessed. (Class functionality can also be statically accessed without
  • 9. instantiation.) 4. Objects access one another's data and implementation using messages passed between them. 5. Objects are able to dynamically respond in different ways and serve up variations in functionality in response to the same message polymorphism. Through the employment of interfaces, polymorphism is achieved because different implementations can exist behind the same interface used in more than one place. If you expected to find encapsulation on the list, you might be surprised. Let's consider some of the points made earlier. Encapsulation is often cited as one of the three most important tenets of an OO language (inheritance and polymorphism are the other two). But while it is vital to OO, encapsulation is really a trait of all modern programming methodology, adopted without question by OOP from both object−based programming and structured programming practice. Encapsulation was certainly supported in the earlier versions of Visual Basic. Therefore, inheritance and polymorphism are the two critical enabling features of all true OO languages. Visual Basic now supports both.  Versions:- [RGPV/Dec2011] Succeeding the classic Visual Basic version 6.0, the first version of Visual Basic .NET debuted in 2002. As of 2014, seven versions of Visual Basic .NET are released. • 2002 (VB 7.0) The first version, Visual Basic .NET, relies on .NET Framework 1.0. The most important feature is managed code, which contrasts with the classic Visual Basic. • 2003 (VB 7.1) Visual Basic .NET 2003 was released with .NET Framework 1.1. New features included support for the .NET Compact Framework and a better VB upgrade wizard. Improvements were also made to the performance and reliability of .NET IDE (particularly the background compiler) and runtime. In addition, Visual Basic .NET 2003 was available in the Visual Studio.NET Academic Edition, distributed to a certain number of scholars from each country without cost.
  • 10. • 2005 (VB 8.0) After Visual Basic .NET 2003, Microsoft dropped ".NET" from the name of the product, calling the next version Visual Basic 2005. For this release, Microsoft added many features intended to reinforce Visual Basic .NET's focus as a rapid application development platform and further differentiate it from C#., including: • Edit and Continue feature Design-time expression evaluation • A pseudo-namespace called "My", which provides: o Easy access to certain areas of the .NET Framework that otherwise require significant code to access Dynamically generated classes (e.g. My.Forms) • Improved VB-to-VB.NET converter • A "using" keyword, simplifying the use of objects that require the Dispose pattern to free resources • Just My Code feature, which hides (steps over) boilerplate code written by the Visual Studio .NET IDE and system library code during debugging • Data Source binding, easing database client/server development To bridge the gaps between itself and other .NET languages, this version added: • Generics • Partial classes, a method of defining some parts of a class in one file and then adding more definitions later; particularly useful for integrating user code with auto-generated code • Operator overloading and null able types • Support for unsigned integer data types commonly used in other languages Visual Basic 2005 introduced the IsNot operator that makes 'If X IsNot Y' equivalent to 'If Not X Is Y'. It gained notoriety when it was found to be the subject of a Microsoft patent application. • 2008 (VB 9.0) Visual Basic 9.0 was released along with .NET Framework 3.5 on 19 November 2007.
  • 11. For this release, Microsoft added many features, including: • A true conditional operator, "If(condition as boolean, truepart, falsepart)", to replace the "IIf" function. • Anonymous types • Support for LINQ • Lambda expressions • XML Literals • Type Inference • Extension methods • 2010 (VB 10.0) In April 2010, Microsoft released Visual Basic 2010. Microsoft had planned to use Dynamic Language Runtime (DLR) for that release but shifted to a co-evolution strategy between Visual Basic and sister language C# to bring both languages into closer parity with one another. Visual Basic's innate ability to interact dynamically with CLR and COM objects has been enhanced to work with dynamic languages built on the DLR such as IronPython and IronRuby. The Visual Basic compiler was improved to infer line continuation in a set of common contexts, in many cases removing the need for the "_" line continuation character. Also, existing support of inline Functions was complemented with support for inline Subs as well as multi-line versions of both Sub and Function lambdas. • 2012 (VB 11.0) Visual Basic .NET 2012 was released along .NET Framework 4.5. Major features introduced in this version include: • Asynchronous programming with "async" and "await" statements • Iterators • Call hierarchy • Caller information • "Global" keyword in "namespace" statements
  • 12. version Version Number Release Date Visual Studio Default in Windows 1.0 1.0.3705.0 2002-02- 13 Visual Studio .NET 1.1 1.1.4322.573 2003-04- 24 Visual Studio .NET 2003 Windows Server 2003 2.0 2.0.50727.42 2005-11- 07 Visual Studio 2005 Windows Server 2003 R2 3.0 3.0.4506.30 2006-11- 06 Windows Vista, Windows Server 2008 3.5 3.5.21022.8 2007-11- 19 Visual Studio 2008 Windows 7, Windows Server 2008 R2 4.0 4.0.30319.1 2010-04- 12 Visual Studio 2010 Hardware and Software Requirements:- [RGPV/Dec2013] This topic gives the requirements for Studio Enterprise Edition Windows Components. Hardware Requirements The following minimum configuration is required: • Processor: Must be at least the minimum specified for the operating system you are using and for Visual Studio. • Memory: Must be at least the minimum specified for the operating system you are using. • Disk space: o 1.2Gb for Studio Enterprise Edition
  • 13. This disk size includes the space needed to cache information locally so that you can modify the installation without the original source media. • DVD drives (either locally or via a network). • Screen with resolution of 800x600 with 256 colors minimum. Preferred screen resolution 1024 x 768 or higher. • Studio Enterprise Edition has additional hardware requirements the same as for Microsoft Visual Studio. See the Visual Studio documentation for details. Software Requirements The following software is required: • On 32-bit Windows, one of: o Windows Vista o Windows Server 2008 o Windows Server 2003 R2, Windows Server 2003 o Windows XP Professional SP2 or later • On 64-bit Windows for X64, one of: o Windows Vista o Windows Server 2008 o Windows Server 2003 o Windows XP Professional • Microsoft Visual Studio 2008 Service Pack 1 or Microsoft Visual Studio Shell 2008. Note that Microsoft Visual Studio Express Edition is not supported. • Microsoft Windows SDK is required if you are using Visual Studio Shell 2008. See the Microsoft Download site and search for Windows SDK. • Microsoft .NET Framework 3.5. This is included with the above versions of Visual Studio.
  • 14. • The Java Development Kit (JDK) is required for compiling Java. The JDK is downloadable from the Sun Web site. After installing the JDK, you must put the tools.jar file for the JDK on your classpath, using a command similar to: set class path=jdk-install-directorylibtools.jar • A Web browser, such as Microsoft Internet Explorer 6.0 or Netscape Navigator 6.1., is required for Enterprise Server Administration in Server Enterprise Edition. • To use Enterprise Server Administration, scripting or JavaScript support must be enabled in your browser. This is on by default in Internet Explorer in most Windows operating systems, apart from Windows 2003. Also, active content must be allowed and not blocked. To enable both these in Internet Explorer: 1. Click Tools > Internet Options. 2. On the Security tab, click Custom Level. In the Scripting section, under Active Scripting, click Enable. 3. On the Advanced tab, scroll down the list to the Security section, and ensure the item Allow active content to run in files on My Computer is checked. • Enterprise Server Help requires the Sun Java Run-time Environment on some Windows systems to enable the Search facility to work. See Third Party Software S.NO RGPV QUESTIONS Year Marks Q.1 Write down Microsoft .NET versions released up to 2010 with version name, version number and release date. Dec2011 10 Q.2 List of essential hardware and software components required to install VB 2008. Dec2013 07
  • 15. Unit-01/Lecture-04 .NET frame work,CTS,CLR,CLS.MSIL,JIT .NET frame work:[ RGPV/ June2009,Dec2010,Dec2011,Dec2013] .NET Framework (pronounced dot net) is a software framework developed by Microsoft that runs primarily on Microsoft Windows. It includes a large library and provides language interoperability (each language can use code written in other languages) across several programming languages. Programs written for .NET Framework execute in a software environment (as contrasted to hardware environment), known as the Common Language Runtime (CLR), an application virtual machine that provides services such as security, memory management, and exception handling. The class library and the CLR together constitute .NET Framework. .NET Framework's Framework Class Library provides user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications. Programmers produce software by combining their own source code with .NET Framework and other libraries. .NET Framework is intended to be used by most new applications created for the Windows platform. Microsoft also produces an integrated development environment largely for .NET software called Visual Studio.
  • 16. Microsoft .NET Framework 4 is Microsoft's comprehensive and consistent programming model for building applications that have secure communication and the ability to model a range of business processes. It provides improvements in Common Language Runtime (CLR) and Base Class Library (BCL), new memory mapped file and numeric types, innovations in the Visual Basic and C# languages, and support for Windows 7 multi-touch, ribbon controls, taskbar extensibility features, and Surface 2.0 SDK. WCF Data Services is a component of the .NET Framework that enables you to create REST-based services and applications that use the Open Data Protocol (OData) to expose and consume data over the Web. The .NET Framework is a technology that supports building and running the next generation of applications and XML Web services. The .NET Framework is designed to fulfill the following objectives: • To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely. • To provide a code-execution environment that minimizes software deployment and versioning conflicts. • To provide a code-execution environment that promotes safe execution of code, including
  • 17. code created by an unknown or semi-trusted third party. • To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. • To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications. • To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code. Introduction To MSIL code, CLR, CTS, CLS and JIT In .NET:- The developer writes source code in any .NET language i.e. it may VB.NET or C# or VC+++.NET, etc. The source code is compiled to Intermediate code known as IL code by the respective compilers for example for C# it is csc.exe compiler, for VB.NET it is vbc.exe compiler, etc. This half compiled code is then given to JIT(just in time compiler) by CLR which converts IL code to machine specific instructions which then gets executed. In this way a .NET code gets compiled. For better understanding have a look to following diagram :
  • 18. MSIL Code : The word IL Code stands for Intermediate Language Code. It is a CPU independent partially compiled code. When we develop our .NET application, we don’t know in what kind of environment our code will run i.e. on which operating system it will be finally hosted, what will be the CPU configuration, etc. So for this purpose we have IL code which is compiled according to machine configuration. IL code is given by Language compiler which is different for different languages for example csc.exe compiler for C#, vbc.exe compiler for VB.NET, etc. CLR (Common language runtime): The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system services. These features are intrinsic to the managed code that runs on the common language runtime. With regards to security, managed components are awarded varying degrees of trust, depending on a number of factors that include their origin (such as the Internet, enterprise network, or local computer). This means that a managed component might or might not be able to perform file-access operations, registry-access operations, or other sensitive functions,
  • 19. even if it is being used in the same active application. The runtime enforces code access security. For example, users can trust that an executable embedded in a Web page can play an animation on screen or sing a song, but cannot access their personal data, file system, or network. The security features of the runtime thus enable legitimate Internet-deployed software to be exceptionally feature rich. CLR stands for Common Language Runtime. It is the heart of our .NET Framework. CLR performs following tasks : 1. Garbage Collection : When we run our .NET application, many objects are created. Garbage collection is a background process which deletes the objects which are not in use by the application and frees memory. 2. Code Access Security(CAS) and Code Verification(CV) : CLR checks the whether the code has access rights and it is safe and authenticated to be used. 3. IL to Native Translation : The main task of CLR is to provide IL code to JIT to ensure that code is fully compiled as per machine specification. The runtime provides the following benefits: • Performance improvements. • The ability to easily use components developed in other languages. • Extensible types provided by a class library. • Language features such as inheritance, interfaces, and overloading for object-oriented programming. • Support for explicit free threading that allows creation of multithreaded, scalable applications. • Support for structured exception handling. • Support for custom attributes.
  • 20. • Garbage collection. • Use of delegates instead of function pointers for increased type safety and security. For more information about delegates, see Common Type System. CTS(Common Types System): CTS stands for Common Types System. In .NET we have various languages like C#, VB.NET, etc. There may be many situations where we want code written in one language to be used in another. In order to ensure that we have a smooth communication between different languages, we have CTS. CTS ensures that data types defined in two different languages get compiled to a common data type so that code written in one language can be used by another. The runtime also enforces code robustness by implementing a strict type-and-code- verification infrastructure called the common type system (CTS). The CTS ensures that all managed code is self-describing. The various Microsoft and third-party language compilers generate managed code that conforms to the CTS. This means that managed code can consume other managed types and instances, while strictly enforcing type fidelity and type safety. CLS(Common Language Specifications) : CLS stands for Common Language Specifications. It is a subset of CTS. CLS is a set of rules or guidelines which if followed ensures that code written in one .NET language can be used by another .NET language. For example one rule is that we cannot have member functions with same name with case difference only i.e we should not have add() and Add(). This may work in C# because it is case-sensitive but if try to use that C# code in VB.NET, it is not possible because VB.NET is not case-sensitive. Common language specification Rules: It describes the minimal and complete set of features to produce code that can be hosted by CLR. It ensures that products of compilers will work properly in .NET environment. Sample Rules: 1. Representation of text strings 2. Internal representation of enumerations
  • 21. 3. Definition of static members and this is a subset of the CTS which all .NET languages are expected to support. 4. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner. JIT(Just In Timer Compiler) : JIT stands for Just In Timer Compiler. It is the internal compiler of .NET which takes IL code from CLR and executes it to machine specific instructions. S.NO RGPV QUESTIONS Year Marks Q.1 What are the features of .NET? Explain the CTS. June2009 10 Q.2 Describe .NET framework with their components (CTS, CLS, and CLR). Dec 2011 10 Q.3 Define the role of CLR in .NET framework. Dec 2012 7 Q.4 Give architecture of .NET framework,give a brief various components of .NET framework. Dec.2013 7 Q.5 Explain the following terms: MSIL, CLR, CTS, Object code. Dec.2013 7
  • 22. Unit-01/Lecture-05 Comparison between VB.Net and VB 6.0 and Similarity between java and .NET[RGPV/june2009] Comparison between VB.Net and VB 6.0:- The current VB6 code base will not run under VB.NET due to changes in VB.NET's syntax and language, its use of the new common runtime, and its switch to WinForms from the VB6 form model. Visual Basic.NET includes an upgrade tool to assist in converting VB6 projects to .NET. The tool adds an upgrade report to your project listing any problems and inserts comments into your code and To Do items into the new Task List indicating where additional changes need to be made.  Variable Declaration:- Always declare variables on separate lines. I always thought this to be good practice anyway. Dim lngOne As Long Dim lngTwo As Long The above statement declares both variables as Long. Dim lngOne, lngTwo As Long This statement, however, declares lngOne as a Variant (which is not supported in .NET) and lngTwo as a Long.  Data Types:- Since VB.NET uses a common runtime among Visual Studio languages, data types in VB needed to be brought into line with those of other languages. Here are some of the data type
  • 23. changes. VB6 VB.NET Comments Integer Short 16 bits Long Integer 32 bits N/A Long 64 bits Variant N/A Use the new 'Object' data type Currency N/A Use Decimal in VB6 or Decimal or Long in VB.NET N/A Decimal Available* in VB6. Native in VB.NET String String VB.NET doesn't support fixed length strings VB.NET no longer supports the Variant and Currency data types. VB documentation has always warned to minimize your use of variants. In .Net they are not supported. Use the object data type instead. The currency data type stores values as 64-bit integers, scaled by 10,000 to give a fixed-point number with 15 digits to the left of the decimal point and 4 digits to the right. In VB.NET you can replace currency variables with the new 64-bit Long variable or the 64-bit decimal data type.  Deprecated Commands:- VB.NET no longer supports the VarPtr, ObjPtr and StrPtr functions which retrieved the underlying memory address of variables. It also no longer supports the LSet command which was used to convert one user defined type to another. Some defunct keywords are: GoSub, Let, Is Missing, DefBool, DefByte, DefLng, DefCur, DefSng, DefDbl, DefDec, DefDate, DefStr, DefObj and DefVar as well as On x Goto. Here are more affected commands: VB6 VB.NET Namespace Method/Property
  • 24. Circle System.Drawing.Graphics DrawEllipse Line System.Drawing.Graphics DrawLine Atn System.Math Atan Sgn System.Math Sign Sqr System.Math Sqrt Lset System.String PadRight Rset System.String PadLeft Rnd Microsoft.VisualBasic.Compatibility.VB6 Rnd Round Microsoft.VisualBasic.Compatibility.VB6 Round DoEvents System.Winform.Application DoEvents VarType System.Object GetType (returns an object of class Type, which has properties to get information. The Set command is no longer supported. That means Set objObject = objAnotherObject becomes: objObject = objAnotherObject The Debug command changes from. Debug.Print to: Debug.Write Debug.WriteLine  Array:- In VB6 declaring an array
  • 25. Dim Items(5) As String Gives you 6 items from index 0 to index 5. In VB.NET, this same declaration will yield 5 elements from index 0 through index 4. Be on the look out for "out of bounds" type errors. Also, all arrays in .NET must now be zero-based.  Default Properties:- VB6 allows you to reference the default property of a control or object without specifying the name of the property. VB.NET disallows this. txtMyText = "Hello" rst!("name") = "Dave" rst!name = "Dave" The above statements must be replaced with: txtMyText.text = "Hello" rst!("name").value = "Dave" rst!name.value = "Dave"  References to Form Controls:- Controls on a form are no longer public in VB.NET. Thus, form2 cannot reference form1.text1.text. What you now need to do is add public Let and Get property procedures to the form for each control property you want to reference from another form. By the way, Let is no longer supported, read on for more info. You can also declare the control you want to reference as Public Shared but that is not the recommended approach.  VB Integrated Development Environment:- The VB Integrated Development Environment (IDE) is now fully integrated with the Visual Studio.NET IDE. Thus VB.NET has a new language-neutral extensibility model. VB.NET add-ins are now VS.NET add-ins. While this lets you create a VB.NET add-in that changes a Visual C# form, your existing add-ins need to change to reflect the new extensibility model.  Parameters:- Parameters can be passed to a procedure in one of two ways. Either by reference (ByRef) or by
  • 26. value (ByVal). When you use the by reference method, changes made to parameters' values in a sub procedure are known when control returns back to the calling procedure. ByRef is the default method of parameter passing in VB6 and prior versions when the parameter's data type is an intrinsic one such as Integer, Long, Boolean, String, etc. Then second method is pass by value (ByVal). This is the default for all non-intrinsic data types. When passed by value, the calling procedure knows nothing about changes made to the parameter's value in a sub procedure. VB.NET passes all parameters ByVal. Thus, don't rely on the default behavior and always explicitly specify ByVal or ByRef in your parameter lists. • Similarity between java and .NET:- Similarities  Both multi-tiered, similar computing technologies  Both support “standards”  Both offer different tools & ways to achieve the same goal.  A lot of parallelism can be seen.  Very difficult to compare and qualify the comparison because each has its own advantages & disadvantages. Microsoft .Net vs. J2EE Comparison Language:-  C# and Java both derive from C and C++.  MS says: “C# combines the power of VC++ with the ease of usage of VB”  Significant features include garbage collection, hierarchical namespaces) are present in both.  Different Syntax but same result.  Java runs on any platform with a Java VM. C# only runs in Windows for the foreseeable future.
  • 27. Unit-01/Lecture-06 Architecture of .Net, Three Tier Architecture Architecture of .Net:- [RGPV/June2011] Common Language Runtime (CLR): The heart of the .Net Framework. It is also called the .Net runtime. It resides above the operating system and handles all .Net applications. It handles garbage collection, Code Access Security (CAS) etc. 1. Microsoft Intermediate Language (MSIL) Code: When we compile our .Net code then it is not directly converted to native/binary code; it is first converted into intermediate code known as MSIL code which is then interpreted by the CLR. MSIL is independent of hardware and the operating system. Cross language relationships are possible since MSIL is the same for all .Net languages. MSIL is further converted into native code.
  • 28. 2. Just in Time Compilers (JIT): It compiles IL code into native executable code (exe or dlls). Once code is converted to IL then it can be called again by JIT instead of recompiling that code. 3. Framework class library: The .Net Framework provides a huge class library called FCL for common tasks. It contains thousands of classes to access Windows APIs and common functions like string manipulations, Data structures, stream, IO, thread, security etc. 4. Common Language Specification (CLS): What makes a language to be .Net compliant? Answer is CLS. Microsoft has defined some specifications that each .Net language has to follow. For e.g.: no pointer, no multiple inheritances etc. 5. Common Type System (CTS): CTS defines some basic data types that IL can understand. Each .Net compliant language should map its data types to these standard data types. This makes it possible for two .Net compliant languages to communicate by passing/receiving parameters to and from each other. For example CTS defines Int32 for C# int and VB integer data types. Three Tier Architecture:- [RGPV/Dec2009] This article explains how to create and implement a 3-tier architecture for our project in ASP.Net. What is a Layer? A layer is a reusable portion of code that performs a specific function. In the .NET environment, a layer is usually set up as a project that represents this specific function. This specific layer is in charge of working with other layers to perform some specific goal.Let’s briefly look at the latter situation first.
  • 29. Data Layer:- A DAL contains methods that help the Business Layer to connect the data and perform required actions, whether to return data or to manipulate data (insert, update, delete and so on). Business Layer:- A BAL contains business logic, validations or calculations related to the data.Though a web site could talk to the data access layer directly, it usually goes through another layer called the Business Layer. The Business Layer is vital in that it validates the input conditions before calling a method from the data layer. This ensures the data input is correct before proceeding, and can often ensure that the outputs are correct as well. This validation of input is called business rules, meaning the rules that the Business Layer uses to make “judgments” about the data. Presentation Layer:- The Presentation Layer contains pages like .aspx or Windows Forms forms where data is presented to the user or input is taken from the user. The ASP.NET web site or Windows Forms application (the UI for the project) is called the Presentation Layer. The Presentation Layer is the most important layer simply because it’s the one that everyone sees and uses. Even with a well structured business and data layer, if the Presentation Layer is designed poorly, this gives
  • 30. the users a poor view of the system. Advantages of a Three-Tier Architecture:- The main characteristic of a Host Architecture is that the application and databases reside on the same host computer and the user interacts with the host using an unfriendly dumb terminal. This architecture does not support distributed computing (the host applications are unable to connect to a database of a strategically allied partner). Some managers find that developing a host application takes too long and it is expensive. These disadvantages consequently led to a Client-Server architecture. A Client-Server architecture is a 2-Tier architecture because the client does not distinguish between Presentation Layer and Business Layer. The increasing demands on GUI controls caused difficulty in managing the mixture of source code from a GUI and the Business Logic (Spaghetti Code). Further, the Client Server Architecture does not support enough the Change Management. Let us suppose that the government increases the Entertainment tax rate from 4% to 8 %, then in the Client-Server case, we need to send an update to each client and they must update synchronously on a specific time otherwise we may store invalid or incorrect information. The Client-Server Architecture is also a burden to network traffic and resources. Let us assume that about five hundred clients are working on a data server. Then we will have five hundred ODBC connections and several ruffian record sets that must be transported from the server to the clients (because the Business Layer remains in the client side). The fact that Client-Server does not have any caching facilities like in ASP.NET causes additional traffic in the network. Normally, a server has better hardware than the client, therefore it is able to compute algorithms faster than a client, so this fact is also an additional argument in favor of the 3-Tier Architecture. This categorization of the application makes the function more reusable easily and it becomes too easy to find the functions that have been written previously. If a programmer wants to make further updates in the application then he can easily understand the previous written code and can update it easily.
  • 31. UNIT 1/LECTURE -07 Understanding assemblies, Roles of assemblies, executable code Introduction of Assemblies:-[RGPV/Dec2010,Dec2011,Dec2013] Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical S.NO RGPV QUESTIONS Year Marks Q.1 Explain the three tier architecture in .NET. Dec2009 10 Q.2 Explain the briefly architecture of .NET. Dec2011 05
  • 32. unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly. An assembly performs the following functions: • It contains code that the common language runtime executes. Microsoft intermediate language (MSIL) code in a portable executable (PE) file will not be executed if it does not have an associated assembly manifest. Note that each assembly can have only one entry point (that is, DllMain, WinMain, or Main). • It forms a security boundary. An assembly is the unit at which permissions are requested and granted. For more information about security boundaries as they apply to assemblies, see Assembly Security Considerations. • It forms a type boundary. Every type's identity includes the name of the assembly in which it resides. A type called MyType that is loaded in the scope of one assembly is not the same as a type called MyType that is loaded in the scope of another assembly. • It forms a reference scope boundary. The assembly's manifest contains assembly metadata that is used for resolving types and satisfying resource requests. It specifies the types and resources that are exposed outside the assembly. The manifest also enumerates other assemblies on which it depends. • It forms a version boundary. The assembly is the smallest versionable unit in the common language runtime; all types and resources in the same assembly are versioned as a unit. The assembly's manifest describes the version dependencies you specify for any dependent assemblies. For more information about versioning, see Assembly Versioning. • It forms a deployment unit. When an application starts, only the assemblies that the application initially calls must be present. Other assemblies, such as localization resources or assemblies containing utility classes, can be retrieved on demand. This allows applications to be kept simple and thin when first downloaded. For more information about deploying assemblies, see Deploying Applications. • It is the unit at which side-by-side execution is supported. For more information about running multiple versions of an assembly, see Assemblies and Side-by-Side Execution.
  • 33. Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. There are several ways to create assemblies. You can use development tools, such as Visual Studio, that you have used in the past to create .dll or .exe files. You can use tools provided in the Windows Software Development Kit (SDK) to create assemblies with modules created in other development environments. You can also use common language runtime APIs, such as Reflection.Emit, to create dynamic assemblies. An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. .NET Assembly contains all the metadata about the modules, types, and other elements it contains in the form of a manifest. The CLR loves assemblies because differing programming languages are just perfect for creating certain kinds of applications. For example, COBOL stands for Common Business-Oriented Language because it’s tailor-made for creating business apps. However, it’s not much good for creating drafting programs. Regardless of what language you used to create your modules, they can all work together within one Portable Executable Assembly. There’s a hierarchy to the structure of .NET code. That hierarchy is Assembly - > Module -> Type -> Method." Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed.
  • 34. Assembly Benefits:- Assemblies are designed to simplify application deployment and to solve versioning problems that can occur with component-based applications. End users and developers are familiar with versioning and deployment issues that arise from today's component-based systems. Some end users have experienced the frustration of installing a new application on their computer, only to find that an existing application has suddenly stopped working. Many developers have spent countless hours trying to keep all necessary registry entries consistent in order to activate a COM class. Many deployment problems have been solved by the use of assemblies in the .NET Framework. Because they are self-describing components that have no dependencies on registry entries, assemblies enable zero-impact application installation. They also simplify uninstalling and replicating applications. Assemblies are of two types: 1. Private Assemblies:- The assembly is intended only for one application. The files of that assembly must be placed in the same folder as the application or in a sub folder. No other application will be able to make a call to this assembly. The advantage of having a private assembly is that, it makes naming the assembly very easy, since the developer need not worry about name clashes with other assemblies. As long as the assembly has a unique name within the concerned application, there won't be any problem. 2. Shared Assemblies:- If the assembly is to be made into a Shared Assembly, then the naming conventions are very strict since it has to be unique across the entire system. The naming conventions should also take care of newer versions of the component being shipped. These are accomplished by giving the assembly a Shared Name. Then the assembly is placed in the global assembly cache, which is a folder in the file system reserved for shared assemblies. Difference between a namespace and assembly name:- A namespace is a logical naming scheme for types in which a simple type name, such as My Type, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionally related to file access.
  • 35. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.  Executable code:- Software in a form that can be run in the computer. It typically refers to machine language, which is the set of native instructions the computer carries out in hardware. Executable files in the DOS/Windows world use .EXE and .COM file extensions, while executable files in Unix and Mac do not require specific extensions. They are identified by their file structure. The Portable Executable (PE) format is a file format for executables, object code, DLLs, FON Font files,[1][2] and others used in 32-bit and 64-bit versions of Windows operating systems. The PE format is a data structure that encapsulates the information necessary for the Windows OS loader to manage the wrapped executable code. This includes dynamic library references for linking, API export and import tables, resource management data and thread-local storage (TLS) data. On NT operating systems, the PE format is used for EXE, DLL, SYS (device driver), and other file types. The Extensible Firmware Interface (EFI) specification states that PE is the standard executable format in EFI environments. PE is a modified version of the Unix COFF (Common Object File Format). PE/COFF is an alternative term in Windows development. A PE file consists of a number of headers and sections that tell the dynamic linker how to map the file into memory. An executable image consists of several different regions, each of which requires different memory protection; so the start of each section must be aligned to a page boundary. For instance, typically the .text section (which holds program code) is mapped as execute/readonly, and the .data section (holding global variables) is mapped as no- execute/readwrite. However, to avoid wasting space, the different sections are not page aligned on disk. Part of the job of the dynamic linker is to map each section to memory individually and assign the correct permissions to the resulting regions, according to the instructions found in the headers.  Reflection:- The classes in the System. Reflection namespace, together with System. Type, enable you to obtain information about loaded assemblies and the types defined within them, such as classes, interfaces, and value types. You can also use reflection to create type instances at run time, and to invoke and access them. For topics about specific aspects of reflection, see Related Topics at the end of this overview.
  • 36. The common language runtime loader manages application domains, which constitute defined boundaries around objects that have the same application scope. Assemblies contain modules, modules contain types, and types contain members. Reflection provides objects that encapsulate assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. You can then invoke the type's methods or access its fields and properties. Typical uses of reflection include the following: • Use Assembly to define and load assemblies, load modules that are listed in the assembly manifest, and locate a type from this assembly and create an instance of it. • Use Module to discover information such as the assembly that contains the module and the classes in the module. You can also get all global methods or other specific, nonglobal methods defined on the module. • Use ConstructorInfo to discover information such as the name, parameters, access modifiers (such as public or private), and implementation details (such as abstract or virtual) of a constructor. Use the GetConstructors or GetConstructor method of a Type to invoke a specific constructor. • Use FieldInfo to discover information such as the name, access modifiers (such as public or private) and implementation details (such as static) of a field, and to get or set field values. • Use EventInfo to discover information such as the name, event-handler data type, custom attributes, declaring type, and reflected type of an event, and to add or remove event handlers. • Use PropertyInfo to discover information such as the name, data type, declaring type, reflected type, and read-only or writable status of a property, and to get or set property values. • Use ParameterInfo to discover information such as a parameter's name, data type, whether a parameter is an input or output parameter, and the position of the parameter in a method signature. The classes of the System.Reflection.Emit namespace provide a specialized form of reflection that enables you to build types at run time. Reflection can also be used to create applications called type browsers, which enable users to select types and then view the information about those types. S.NO RGPV QUESTION YEAR MARKS Q.1 What is meant by assembly? Write its importance and role. Dec2013 07 Q.2 Explain Assembly with their nature and role. Dec2011 10 Q.3 Write short notes on the Following: DEC 2010 5
  • 37. Assemblies and class libraries. UNIT 1/LECTURE-08 Manifest,Metadata,Manage code and Manage data Manifest:- An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE (Portable Executable) file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE (Portable Executable) file that contains only assembly manifest information. The following table shows the information contained in the assembly manifest. The first four items the assembly name, version number, culture, and strong name information make up the assembly's identity. Assembly name: A text string specifying the assembly's name. Version number: A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy. Culture: Information on the culture or language the assembly supports. This information should be used only to designate an assembly as a satellite assembly containing culture- or language-specific information. (An assembly with culture information is automatically assumed to be a satellite assembly.) Strong name information: The public key from the publisher if the assembly has been given a strong name. List of all files in the assembly: A hash of each file contained in the assembly and a file name. Note that all files that make up the assembly must be in the same directory as the file containing the assembly manifest. Type reference information: Information used by the runtime to map a type reference to the file that contains its declaration and implementation. This is used for types that are exportedfrom the assembly. Information on referenced assemblies: A list of other assemblies that are statically referenced by the assembly. Each reference includes the dependent assembly's name, assembly metadata (version, culture, operating system, and so on), and public key, if the assembly is strong named. Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the
  • 38. assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information. Metadata:- Metadata is information about a PE. In COM, metadata is communicated through non- standardized type libraries. In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it contains information such as the assembly’s name, version, language (spoken, not computera.k.a., culture), what external types are referenced, what internal types are exposed, methods, properties, classes, and much more. The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s header. Information about classes, modules, and so forth allows the CLR to know in advance what structures are necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies, either locally or across networks. Just-in-time (JIT) compilers use the metadata to turn IL into executable code. Other programs take advantage of metadata as well. A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file has completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when a user hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the metadata in a PE. Literally, this tool is an IL disassembler. Metadata in .Net is binary information which describes the characteristics of a resource . This information include Description of the Assembly , Data Types and members with their declarations and implementations, references to other types and members , Security permissions etc. A module's metadata contains everything that needed to interact with another module. During the compile time Metadata created with Microsoft Intermediate Language (MSIL) and stored in a file called a Manifest. Both Metadata and Microsoft Intermediate Language (MSIL)
  • 39. together wrapped in a Portable Executable (PE) file. During the runtime of a program Just In Time (JIT) compiler of the Common Language Runtime (CLR) uses the Metadata and converts Microsoft Intermediate Language (MSIL) into native code. When code is executed, the runtime loads metadata into memory and references it to discover information about your code's classes, members, inheritance, and so on. Moreover Metadata eliminating the need for Interface Definition Language (IDL) files, header files, or any external method of component reference. Manage code and Manage data:- Managed code is code that is written to target the services of the Common Language Runtime. In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR). Closely related to managed code is managed data--data that is allocated and de- allocated by the Common Language Runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. Managed Code in Microsoft .Net Framework, is the code that has executed by the Common Language Runtime (CLR) environment. On the other hand Unmanaged Code is directly executed by the computer's CPU. Data types, error-handling mechanisms, creation and destruction rules, and design guidelines vary between managed and unmanaged object models. The benefits of Managed Code include programmers convenience and enhanced security . Managed code is designed to be more reliable and robust than unmanaged code , examples are Garbage Collection , Type Safety etc. The Managed Code running in a Common Language Runtime (CLR) cannot be accessed outside the runtime environment as well as cannot call directly from outside the runtime environment. This makes the programs more isolated and at the same time computers are more secure . Unmanaged Code can bypass the .NET Framework and make direct calls to the Operating System. Calling unmanaged code presents a major security risk. S.NO RGPV QUESTION YEAR MARKS Q.1 Write short notes on the following: Metadata Dec2011 4
  • 40. UNIT 1/LECTURE-09 .NET Security Model: [RGPV/Dec2013,Dec2011,Dec2010] Introduction When I was first faced with the .NET Framework security and cryptography fist, I noticed that most of the quick-start articles sufferes from lots of low-level details and explanations of the nuts and bolts of .NET Framework Security. But for the first time, I needed a brief, easy to understand and remember tutorial, instead. So, actually this is not an article. This is rather a bird's-eye overview of the .NET Framework security model, with visual illustrations. Security concepts You can implement the security model in your applications in a declarative and/or an imperative way. In most cases, you should prefer declarative security, and implement the security model only when some application security issues can be known only at runtime. Sample of declarative security: [assembly : FileDialogPermissionAttribute( SecurityAction.RequestMinimum, Unrestricted=true)] Sample of imperative security: FileDialogPermission fileDlgPermission = new
  • 41. FileDialogPermission(PermissionState.Unrestricted); fileDlgPermission.Demand(); if (myDlgForm.ShowDialog() == DialogResult.OK) MessageBox.Show(myDlgForm.FileName); .NET Framework Security Model:- Code Access Security (CAS) Permissions
  • 42. Code groups CLR examines all code groups in the hierarchy. When the code group is marked as Exclusive, then the CLR stops checking for group membership. Next, the CLR determines the permission sets for each code group. If the code is a member of the code group that is marked as Exclusive, only the permission set of that code group is taken into account, otherwise the CLR calculates the permission as a Union of all permission sets of all code groups that the running code is a member of. S.NO RGPV QUESTION YEAR MARKS Q.1 What do you mean by .NET Security model? Dec2011 10 Q.2 Explain security model in .NET. DEC2010 10 Q.3 Describe briefly the .NET security model. Dec2013 03