DOTNET
1. What is .NET
Framework
The .NET framework is the Platform for building, deploying and running
web services and applications. It provides a
highly productive, standards-based, multi-language environment for building such
applications. The .NET Framework consists of
three main parts: the common language runtime, a hierarchical set of unified
class libraries, and a componentized version of Active Server Pages called
ASP.NET.
2. Diff Betn ASP and ASP.NET:
3. What u mean by type safety
Type safe means preventing programs from accessing memory outside the
bounds of an object's public properties. Type-safe code accesses only the memory
locations it is authorized to access. For example, type-safe code cannot
directly read values from another object's private fields or code
areas.
During just-in-time compilation, an optional verification process
examines the metadata and intermediate language of a method to verify that they
are type-safe. If the code has permission to bypass verification, then this
process is skipped. Although verification of type-safety is not mandatory for
managed code, type-safety is important
for assembly isolation and security enforcement. When code is type- safe,
the common language runtime can completely isolate assemblies from each other.
This isolation helps ensure that assemblies cannot adversely affect each other
and it increases application reliability. Type-safe components can execute
safely in the same process even if they are trusted at different levels.
Code that is proven during verification to
be type-safe is called verifiably type-
safe code. Code can be type-safe, yet not be verifiably type-safe, due to
the limitations of the verification process or of the
compiler.
When code is not type-safe, unwanted side effects can occur. For example,
the runtime cannot prevent unsafe code from calling into native (unmanaged) code
and performing malicious operations. When code is type-safe, the runtime's
security enforcement mechanism ensures that it does not access native code
unless it has permission to do so.
3. Advantages of
C#
·
Full
support for OOP, including Virtual Functions, and Operator
Overloading
·
A
consistent and well-defined basic types
·
Inbuilt
support for automatic generation of XML documentation
·
Automatic cleanup of dynamically
allocated memory
·
Pointers and direct memory access
are available but we can use without them in almost all
cases.
·
Can be
used to write ASP.Net dynamic web pages.
Disadvantages:
- Not extremely powerful when there is
looping of around 1000 to 1500 machine cycles.
- Do not clean up the resources the
milliseconds they r no longer needed.
surrogates
4. Reflection:
Because Assemblies are Self-Describing, this opens the theoretical
possibility of programmatic access to assembly metadata. There are in fact some
base classes that are designed to achieve this. The technology is know as
REFLECTION.
5. .NET Base Classes:
This is an extensive class library that contains pre-written code to
perform a huge range of tasks on windows, ranging thru displaying windows and
forms, accessing base services, reading and writing to files
etc.,
6. Advantage of Stack over Heap:
- Stack or value types can be allocate much
more quickly than the heap-allocated types.
- Values of the Stack are instantly and
automatically deallocated once they go out of scope.
- Its easy to copy the value of one value
type variable into another value type variable.
7. Merge Module:
- A Merge module (.msm) is a single package
that contains DLLs, registry entries,
resource files, and setup logic to install the
component.
- A merge module allows the creation of
reusable set modules.
- When a Windows Installer package is built
for the windows application, the merge module can be easily included with this
installer package.
8. The components of .Net Framework
- Assemblies: An Assembly is the logical unit that contains compiled
code targeted at .Net. An Assembly is completely self-describing, and is also
a logical rather than a physical unit however, which means that it can be
stored across more than one file. If the assembly is stored across more than
one file, then there will be one main file that contains the entry point, and
which describes the other files in the assembly.
- Metadata and manifest : An important
characteristic of assemblies is that they contain metadata which describes the
types and methods defined in the corresponding code. An assembly however also
contains the metadata, that describes the assembly itself. This assembly
metadata, contained in an area known as “Manifest”, allows checks to be made
on the version of the assembly, and on its integrity.
THE ADVANTAGE OF METADATA IS THAT APPLICATIONS OR OTHER ASSEMBLIES THAT
CALL UP CODE IN A GIVEN ASSEMBLY, DO NOT NEED TO REFER TO THE REGISTRY, OR TO
ANY OTHER DATA SOURCE, IN ORDER TO FIND OUT HOW TO USE THAT ASSEMBLY. THIS IS
SIGNIFICANT BREAK FROM
WHERE
THE GUID’S OF THE COMPONENTS AND INTERFACES NEED TO OBTAINED FROM THE REGISTRY.
EVEN WHEN THE ASSEMBLY ARE SPREAD ACROSS DIFFERENT FILES, THERE IS NO
POSSIBILITY FOR OUT OF SYNCHRONIZATION. THIS IS BECAUSE, THE FILE CONTAINING THE
ASSEMBLY ENTRY POINT ALSO STORES THE DETAILS OF, AND A HASH OF, THE CONTENTS OF THE OTHER
FILES, WHICH MEANS THAT IF ONE OF THE FILES GETS REPLACED, OR IN ANYWAY TAMPERED
WITH, THIS WILL ALMOST CERTAINLY BE DETECTED AND THE ASSEMBLY WILL REFUSE TO
LOAD.
- Shared Vs Private
Assembly:
Private assemblies are the simplest type. Private assemblies will
normally ship with some software, and are intended only to be used with that
software.
·
No risk of one s/w package overwriting, modifying, or
accidentally loading private assemblies intended for another
package.
·
Less need to take security
precautions
·
No problem abt name
collisions
BECAUSE PRIVATE
ARE SELF-CONTAINED, THE PROCESS OF INSTALLING IT IS SIMPLE. THERE ARE NO
REGISTRY ENTRIES, AND SO ON TO BE MADE. THIS PROCESS IS KNOWN AS ZERO IMPACT
INSTALLATION.
Shared assemblies are those assemblies that intended to be common
libraries that any other application should be able to use. More precautions
need to taken against the following risks.
·
Name collisions, involving another company’s shared
assembly, implementing types that have the same name as those in our shared
assembly.
·
The risk of an assembly being overwritten by a different
version.
The solutions
to the problems involves placing the shared assembly in a special directory
subtree in the file system, that is known as Assembly
cache.
In order avoid
the risk of name collisions, shared assemblies are given a name that is based on
PRIVATE KEY CRYPTOGRAPHY. This name is known as STRONG NAME, Is guaranteed to be
unique, and must be quoted by applications that wish to reference a shared
assembly.
Problems
associated with the risk of overwriting an assembly are addressed by specifying
version information in the assembly manifest, and by allowing side-by-side
installs.
Namespaces are
the way that .NET avoids the name clashes between classes. They are designed,
for example, to avoid the situation in which you define a class to represent a
customer, and call your class customer, and someone else do the same
thing.
A Namespace is no more
than a grouping of datatypes, but it has the effect that the names of all
datatypes with in a namespace automatically get prefixed with the name of the
namespace. It is also possible to nest the namespace within each other.
If a namespace is not explicitly supplied,
then the type will be added automatically to a nameless global
namespace.
Application domains are designed in
such a way of separating the components without resulting in the performance
problems associated with passing data between processes. The idea is that any
one process is divided in to number of Application domains. Each Application
domain roughly corresponds to a single appln, and each thread of execution will
be running in particular Application domain.
If different
executables are running in the same process space, then they are clearly able to
share the data because theoretically they can see each others
data.
Although this
is possible in principle, the .NET framework ensures that this does not happen
in practice by the technique of inspecting the code for each running appln, to
ensure that the code does not stray outside its own data areas. If a running appln specifically does need to
communicate or share the data with other appln running in different appln
domain, then it must do so by the calling .NET’ remoting services, under the
SYSTEM.REMOTING namespace.
Code that has been verified to check with
that it cannot access data outside its appln domain(other than thru explicit
remoting mechanism) , it is said to be type safe ( or memory type
safe).
The JIT
compiler simply compiles each portion of code as it is called(hence the name
just-in-time compiler). When code is compiled once, the resultant native
executable is stored until the application exits, so that it does not need to be
recompiled the next time that portion of
code is run.
Since the final
stage of compilation takes place at runtime, the JIT compiler will know exactly
what processor type the program will run on. This means that it can optimize the
final executable code to take advantage of any features or particular machine
code instructions offered by the particular
processor.
9. Executable Vs Library
Assembly:
The same assembly structure is used for both Executable and Library code.
The only real difference is that an executable assembly contains the main
program entry point, whereas the library assembly
doesn’t.
|