what is the difference between Convert.toString and .toString ()?

Just to give an understanding of what the above question means see the below code.
int i =0;
MessageBox.Show(i.ToString());
MessageBox.Show(Convert.ToString(i));
We can convert the integer “i” using “i.ToString()” or “Convert.ToString” so what is the
difference. The basic difference between them is “Convert” function handles NULLS while
“i.ToString()” does not it will throw a NULL reference exception error. So as a good coding
practice using “convert” is always safe.

How to prevent my .NET DLL to be decompiled?

By design, .NET embeds rich Meta data inside the executable code using MSIL. Any one can
easily decompile your DLL back using tools like ILDASM (owned by Microsoft) or Reflector for
.NET which is a third party. Secondly, there are many third party tools, which make this
decompiling process a click away. So any one can easily look in to your assemblies and reverse
engineer them back in to actual source code and understand some real good logic, which can
make it easy to crack your application.
The process by which you can stop this reverse engineering is using “obfuscation”. It is a
technique, which will foil the decompilers. Many third parties (XenoCode, Demeanor for .NET)
provide .NET obfuscation solution. Microsoft includes one that is Dotfuscator Community
Edition with Visual Studio.NET.

What is CODE Access security?

CAS is part of .NET security model that determines whether a piece of code is allowed to run and
what resources it can use while running. Example CAS will allow an application to read but not
to write and delete a file or a resource from a folder..

what is the difference between System exceptions and Application

All exception derives from Exception Base class. Exceptions can be generated programmatically
or can be generated by system. Application Exception serves as the base class for all applicationspecific
exception classes. It derives from Exception but does not provide any extended
functionality. You should derive your custom application exceptions from Application Exception.
Application exception is used when we want to define user-defined exception, while system
exception is all that is defined by .NET.

What is the difference between VB.NET and C#?

Well this is the most debatable issue in .NET community and people treat languages like religion.
It is a subjective matter which language is best. Some like VB.NET’s natural style and some like
professional and terse C# syntaxes. Both use the same framework and speed is very much
equivalents. Still let us list down some major differences between them:-
Advantages VB.NET:-
• Has support for optional parameters that makes COM interoperability much easy.
• With Option Strict off late binding is supported.Legacy VB functionalities can be
used by using Microsoft.VisualBasic namespace.
• Has the WITH construct which is not in C#.
• The VB.NET parts of Visual Studio .NET compiles your code in the background.
While this is considered an advantage for small projects, people creating very
large projects have found that the IDE slows down considerably as the project
gets larger.
Advantages of C#
• XML documentation is generated from source code but this is now been
incorporated in Whidbey.
• Operator overloading which is not in current VB.NET but is been introduced in
Whidbey.
• Use of this statement makes unmanaged resource disposal simple.
• Access to Unsafe code. This allows pointer arithmetic etc, and can improve
performance in some situations. However, it is not to be used lightly, as a lot of
the normal safety of C# is lost (as the name implies).This is the major difference
that you can access unmanaged code in C# and not in VB.NET.

What is concept of Boxing and Unboxing ?

Boxing and unboxing act like bridges between value type and reference types. When we convert
value type to a reference type it’s termed as boxing. Unboxing is just vice-versa. When an object
box is cast back to its original value type, the value is copied out of the box and into the
appropriate storage location.
Below is sample code of boxing and unboxing where integer data type are converted in to object
and then vice versa.
int i = 1;
object obj = i; // boxing
int j = (int) obj; // unboxing

What are Value types and Reference types?


Value types directly contain their data that are either allocated on the stack or allocated in-line in
a structure. So value types are actual data.
Reference types store a reference to the value's memory address, and are allocated on the heap.
Reference types can be self-describing types, pointer types, or interface types. You can view
reference type as pointers to actual data.
Variables that are value types each have their own copy of the data, and therefore operations on
one variable do not affect other variables. Variables that are reference types can refer to the same
object; therefore, operations on one variable can affect the same object referred to by another
variable. All types derive from the System. Object base type.

(A) What are different types of JIT?


JIT compiler is a part of the runtime execution environment.
In Microsoft .NET there are three types of JIT compilers:
• Pre-JIT: - Pre-JIT compiles complete source code into native code in a single
compilation cycle. This is done at the time of deployment of the application.
• Econo-JIT: - Econo-JIT compiles only those methods that are called at runtime.
However, these compiled methods are removed when they are not required.
• Normal-JIT: - Normal-JIT compiles only those methods that are called at runtime.
These methods are compiled the first time they are called, and then they are stored in
cache. When the same methods are called again, the compiled code from cache is used
for execution.

What is reflection?


All .NET assemblies have metadata information stored about the types defined in modules. This
metadata information can be accessed by mechanism called as “Reflection”. System. Reflection
can be used to browse through the metadata information.
Using reflection, you can also dynamically invoke methods using System.Type.Invokemember.
Below is sample source code if needed you can also get this code from CD provided, go to
“Source code” folder in “Reflection Sample” folder.
Public Class Form1
Private Sub Form1_Load (ByVal sender As System. Object, ByVal e as
System.EventArgs) Handles MyBase.Load
Dim Pobjtype As Type
Dim PobjObject As Object
Dim PobjButtons As New Windows.Forms.Button ()
Pobjtype = PobjButtons.GetType ()
For Each PobjObject in Pobjtype.GetMembers
LstDisplay.Items.Add (PobjObject.ToString ())
Next
End Sub
End Class

What is garbage collection?

Garbage collection is a CLR feature, which automatically manages memory. Programmers forget to release the objects while coding ... Laziness (Remember in VB6 where one of the good practices is to set object to nothing). CLR automatically releases objects when they are no longer in use and refernced. CLR runs on non-deterministic to see the unused objects and cleans them. One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. We should avoid using destructors because before GC destroys the object it first executes destructor in that case it will have to wait for code to release the unmanaged resource. This results in additional delays in GC. So it is recommended to implement IDisposable interface, write cleanup code in Dispose method, and call GC.SuppressFinalize method. Its like instructing GC not to call your constructor.

How do I find the overall database size?

The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:

select sum(bytes)/1024/1024 "Meg" from dba_data_files;


To get the size of all TEMP files:

select nvl(sum(bytes),0)/1024/1024 "Meg" from dba_temp_files;

To get the size of the on-line redo-logs:

select sum(bytes)/1024/1024 "Meg" from sys.v_$log;

Putting it all together into a single query:

select a.data_size+b.temp_size+c.redo_size "total_size"

from ( select sum(bytes) data_size
from dba_data_files ) a,
( select nvl(sum(bytes),0) temp_size
from dba_temp_files ) b,
( select sum(bytes) redo_size
from sys.v_$log ) c;

Can one resize tablespaces and data files?

Add more files to tablespaces
To add more space to a tablespace, one can simply add another file to it. Example:
ALTER TABLESPACE USERS ADD DATAFILE '/oradata/orcl/users1.dbf' SIZE 100M;
Resize datafiles
One can manually increase or decrease the size of a datafile from Oracle 7.2 using the following command:
ALTER DATABASE DATAFILE 'filename2' RESIZE 100M;
Because you can change the sizes of datafiles, you can add more space to your database without adding more datafiles. This is beneficial if you are concerned about reaching the maximum number of datafiles allowed in your database.
Manually reducing the sizes of datafiles allows you to reclaim unused space in the database. This is useful for correcting errors in estimations of space requirements.
Extend datafiles
Also, datafiles can be allowed to automatically extend if more space is required. Look at the following commands:
CREATE TABLESPACE pcs_data_ts
DATAFILE 'c:ora_appspcspcsdata1.dbf' SIZE 3M
AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED
DEFAULT STORAGE ( INITIAL 10240
NEXT 10240
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0)
ONLINE
PERMANENT;
ALTER DATABASE DATAFILE 1 AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED;

How does one see the uptime for a database?

Look at the following SQL query:
SELECT to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time"
FROM sys.v_$instance;
Marco Bergman provided the following solution:
SELECT to_char(logon_time,'Dy dd Mon HH24:MI:SS') "DB Startup Time"
FROM sys.v_$session
WHERE sid=1 /* this is pmon */
/
Tarun Dua provided the following solution:
Check on operating system level when the PMON process was stated (UNIX/ LINUX only):
ps -ef | grep pmon
Users still running on Oracle 7 can try one of the following queries:
column STARTED format a18 head 'STARTUP TIME'

select C.INSTANCE,
to_date(JUL.VALUE, 'J')
|| to_char(floor(SEC.VALUE/3600), '09' )
|| ':'
-- || substr (to_char(mod(SEC.VALUE/60, 60), '09'), 2, 2)
|| substr (to_char(floor(mod(SEC.VALUE/60, 60)), '09'), 2, 2)
|| '.'
|| substr (to_char(mod(SEC.VALUE, 60), '09'), 2, 2) STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC,
SYS.V_$THREAD C
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
select to_date(JUL.VALUE, 'J')
|| to_char(to_date(SEC.VALUE, 'SSSSS'), ' HH24:MI:SS') STARTED
from SYS.V_$INSTANCE JUL,
SYS.V_$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';
select to_char(to_date(JUL.VALUE, 'J') + (SEC.VALUE/86400), -- Return a DATE
'DD-MON-YY HH24:MI:SS') STARTED
from V$INSTANCE JUL,
V$INSTANCE SEC
where JUL.KEY like '%JULIAN%'
and SEC.KEY like '%SECOND%';

Can one rename a tablespace?

From Oracle 10g Release 1, users can rename tablespaces. Example:
ALTER TABLESPACE ts1 RENAME TO ts2;
However, you must adhere to the following restrictions:
• COMPATIBILITY must be set to at least 10.0.1
• Cannot rename SYSTEM or SYSAUX
• Cannot rename an offline tablespace
• Cannot rename a tablespace that contains offline datafiles
For older releases, use the following workaround:
• Export all of the objects from the tablespace
• Drop the tablespace including contents
• Recreate the tablespace
• Import the objects

Can one rename a database user (schema)?

No, this is listed as Enhancement Request 158508. Workaround:

-->Do a user-level export of user A
-->create new user B
-->import system/manager fromuser=A touser=B
-->drop user A

How does one rename a database?

How does one rename a database?
Follow these steps to rename a database:

==>Start by making a full database backup of your database (in case you need to restore if this procedure is not working).
==>Execute this command from sqlplus while connected to 'SYS AS SYSDBA':

ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS;

==>Locate the latest dump file in your USER_DUMP_DEST directory (show parameter USER_DUMP_DEST) - rename it to something like dbrename.sql.
==>Edit dbrename.sql, remove all headers and comments, and change the database's name. Also change "CREATE CONTROLFILE REUSE ..." to "CREATE CONTROLFILE SET ...".
Shutdown the database (use SHUTDOWN NORMAL or IMMEDIATE, don't ABORT!) and run dbrename.sql.
==>Rename the database's global name:


ALTER DATABASE RENAME GLOBAL_NAME TO new_db_name;

What database aspects should be monitored?

One should implement a monitoring system to constantly monitor the following aspects of a database. This can be achieved by writing custom scripts, implementing Oracle's Enterprise Manager, or buying a third-party monitoring product. If an alarm is triggered, the system should automatically notify the DBA (e-mail, text, etc.) to take appropriate action.
Infrastructure availability:
Is the database up and responding to requests
Are the listeners up and responding to requests
Are the Oracle Names and LDAP Servers up and responding to requests
Are the Application Servers up and responding to requests
Etc.
Things that can cause service outages:
Is the archive log destination filling up?
Objects getting close to their max extents
Tablespaces running low on free space/ Objects what would not be able to extend
User and process limits reached
Etc.

What database block size should I use?

Oracle recommends that your database block size match, or be multiples of your operating system block size. One can use smaller block sizes, but the performance cost is significant. Your choice should depend on the type of application you are running. If you have many small transactions as with OLTP, use a smaller block size. With fewer but larger transactions, as with a DSS application, use a larger block size.

If you are using a volume manager, consider your "operating system block size" to be 8K. This is because volume manager products use 8K blocks (and this is not configurable).

How does one create a new database?

One can create and modify Oracle databases using the Oracle DBCA (Database Configuration Assistant) utility. The dbca utility is located in the $ORACLE_HOME/bin directory. The Oracle Universal Installer (oui) normally starts it after installing the database server software to create the starter database.

One can also create databases manually using scripts. This option, however, is falling out of fashion as it is quite involved and error prone. Look at this example for creating an Oracle 9i or higher database:

CONNECT SYS AS SYSDBA
ALTER SYSTEM SET DB_CREATE_FILE_DEST='/u01/oradata/';
ALTER SYSTEM SET DB_CREATE_ONLINE_LOG_DEST_1='/u02/oradata/';
ALTER SYSTEM SET DB_CREATE_ONLINE_LOG_DEST_2='/u03/oradata/';
CREATE DATABASE;

How will Windows Communication Foundation change the way developers build applications?

Windows Communication Foundation radically simplifies development of distributed applications in several ways. First, Windows Communication Foundation reduces complexity by unifying the silos that exist with today's distributed technology stacks (Enterprise Services, System.Messaging, .NET Remoting, ASMX, and WSE). This enables developers to compose distributed applications using the best features of each of today's stacks. Second, Windows Communication Foundation maximizes developer productivity through an attribute-based programming model. Finally, Windows Communication Foundation is the first development framework built from the ground up on the principle of service-orientation—enabling developers to build loosely coupled applications that interoperate securely and reliably across platforms.

What is Windows Communication Foundation?

Windows Communication Foundation is Microsoft's unified programming model for building service-oriented applications with managed code. It extends the .NET Framework to enable developers to build secure and reliable transacted Web services that integrate across platforms and interoperate with existing investments. Windows Communication Foundation combines and extends the capabilities of existing Microsoft distributed systems technologies, including Enterprise Services, System.Messaging, Microsoft .NET Remoting, ASMX, and WSE to deliver a unified development experience across multiple axes, including distance (cross-process, cross-machine, cross-subnet, cross-intranet, cross-Internet), topologies (farms, fire-walled, content-routed, dynamic), hosts (ASP.NET, EXE, Windows Presentation Foundation, Windows Forms, NT Service, COM+), protocols (TCP, HTTP, cross-process, custom), and security models (SAML, Kerberos, X509, username/password, custom).

What is Service-Orientation and how is it related to Windows Communication Foundation?

Service Orientation is a specific set of architectural principles for building loosely coupled services that help developers maximize the return on your application investments over time. The services have explicit boundaries, are autonomous, share schema and contracts, and determine compatibility based on policy. Applications based on these principles provide benefits in maintainability, reusability, and manageability of connected systems. Windows Communication Foundation is the first programming model built from the ground up for building service-oriented applications.

Why is service orientation important?

Loosely-coupled applications built on the tenets of service orientation yield benefits in maintainability, reusability, and manageability of connected systems. Service-oriented applications also more closely reflect real-world processes and relationships. Microsoft sees service orientation as a means to an end—that end being a set of connected systems that optimize communications across a business—connecting people, information, and devices.

Does service-oriented development conflict with object-oriented development?

No. Service-oriented development complements object-oriented (OO) development. Object-oriented development continues to fulfill an important role in the internal design of services. Service-orientation deals with how to interconnect services to build connected systems. To use an architecture analogy, OO development addresses the architecture within a single building (a service), while service-orientation addresses the issues around city planning (a system).

How will Windows Communication Foundation make service-oriented development easier?

Today, it is difficult to build service-oriented applications due to the lack of an intuitive service-oriented programming model. Web services provide a great start, but lack support for more advanced communication, including secure and reliable transacted services. Windows Communication Foundation provides both an intuitive service-oriented programming model and the advanced functionality to create service-oriented applications that interoperate across organizational and platform boundaries.

Will Windows Communication Foundation applications interoperate with Web services built with other technologies?

Yes. By default, services built with Windows Communication Foundation will communicate with other services based on the interoperable Web services specifications. This means that Windows Communication Foundation services will communicate with any application built on an infrastructure that also conforms to these standards. Microsoft is deeply committed to platform interoperability and is an active member of key standards organizations defining the latest Web services standards. Microsoft also continues to engage in public interoperability workshops to help ensure cross-platform communication with other vendors.

What specifications will Windows Communication Foundation support?

Windows Communication Foundation will support a broad range of Web services standards, including basic standards (XML, XSD, XPath, SOAP, WSDL) and advanced standards and specifications that comprise the WS-* architecture. These include WS-Addressing, WS-Policy, WS-Security, WS-Trust, WS-SecureConversation, WS-ReliableMessaging, WS-AtomicTransaction, WS-Coordination, WS-Policy, and MTOM.

What are activities in WWF?

Activities are the elemental unit of a workflow. They are added to a workflow programmatically in a manner similar to adding XML DOM child nodes to a root node. When all the activities in a given flow path are finished running, the workflow instance is completed.

An activity can perform a single action, such as writing a value to a database, or it can be a composite activity and consist of a set of activities. Activities have two types of behavior: runtime and design time. The runtime behavior specifies the actions upon execution. The design time behavior controls the appearance of the activity and its interaction while being displayed within the designer.

What is password fatigue?


As the use of internet increases, as increases the danger of online identity theft, fraud, and privacy. Users must track a growing number of accounts and passwords. This burden results in "password fatigue," and that results in less secure practices, such as reusing the same account names and passwords at many sites.

In Terms of WCF, what do you understand by metadata of a service?


The metadata of a service describes the characteristics of the service that an external entity needs to understand to communicate with the service. Metadata can be consumed by the Service Model Metadata Utility Tool ( Svcutil.exe) to generate a WCF client and accompanying configuration that a client application can use to interact with the service.

The metadata exposed by the service includes XML schema documents, which define the data contract of the service, and WSDL documents, which describe the methods of the service.

What is a fault contract?


A fault contract can be associated with a service operation to denote errors that can be returned to the caller. An operation can have zero or more faults associated with it. These errors are SOAP faults that are modeled as exceptions in the programming model.

What is a message contract?

A message contact describes the format of a message. For example, it declares whether message elements should go in headers versus the body, what level of security should be applied to what elements of the message, and so on.

What is an operation contract?


An operation contract defines the parameters and return type of an operation. When creating an interface that defines the service contract, you signify an operation contract by applying the OperationContractAttribute attribute to each method definition that is part of the contract. The operations can be modeled as taking a single message and returning a single message, or as taking a set of types and returning a type. In the latter case, the system will determine the format for the messages that need to be exchanged for that operation.

In terms of WCF, What is binding?


A binding defines how an endpoint communicates to the world. It is constructed of a set of components called binding elements that "stack" one on top of the other to create the communication infrastructure. At the very least, a binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.

In terms of WCF, What is an address?


An address specifies the location where messages are received. It is specified as a Uniform Resource Identifier (URI). The schema part of the URI names the transport mechanism to be used to reach the address, such as "HTTP" and "TCP", and the hierarchical part of the URI contains a unique location whose format is dependent on the transport mechanism.

In terms of WCF, What is an infrastructure endpoint?


An endpoint that is exposed by the infrastructure to facilitate functionality that is needed or provided by the service that does not relate to a service contract. For example, a service might have an infrastructure endpoint that provides metadata information.

In terms of WCF, What is an application endpoint?

An endpoint exposed by the application and that corresponds to a service contract implemented by the application.

In terms of WCF, What is an endpoint?


An endpoint is a construct at which messages are sent or received (or both). It comprises a location (an address) that defines where messages can be sent, a specification of the communication mechanism (a binding) that described how messages should be sent, and a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.

An WCF service is exposed to the world as a collection of endpoints.

In terms of WCF, What is a service?


A service is a construct that exposes one or more endpoints, with each endpoint exposing one or more service operations.

In terms of WCF, What is a message?

A message is a self-contained unit of data that may consist of several parts, including a body and headers.

What is a service contract ( In WCF) ?


In every service oriented architecture, services share schemas and contracts, not classes and types. What this means is that you don't share class definitions neither any implementation details about your service to consumers.

Everything your consumer has to know is your service interface, and how to talk to it. In order to know this, both parts (service and consumer) have to share something that is called a Contract.

In WCF, there are 3 kinds of contracts: Service Contract, Data Contract and Message Contract.

A Service Contract describes what the service can do. It defines some properties about the service, and a set of actions called Operation Contracts. Operation Contracts are equivalent to web methods in ASMX technology

What is XBAP?


XAML browser application (XBAP) can be used to create a remote client that runs inside a Web browser. Built on the same foundation as a stand-alone WPF application, an XBAP allows presenting the same style of user interface within a downloadable browser application. The best part is that the same code can potentially be used for both kinds of applications, which means that developers no longer need different skill sets for desktop and browser clients. The downloaded XBAP from the Internet runs in a secure sandbox , thus it limits what the downloaded application can do.

What is XAML ?


WPF relies on the eXtensible Application Markup Language (XAML). An XML-based language, XAML allows specifying a user interface declaratively rather than in code. This makes it much easier for user interface design tools like MS Expression Blend to generate and work with an interface specification based on the visual representation created by a designer. Designers will be able to use such tools to create the look of an interface and then have a XAML definition of that interface generated for them. The developer imports this definition into Visual Studio, then creates the logic the interface requires.

What contemporary computing problems WPF solves?


User interfaces needs to display video, run animations, use 2/3D graphics, and work with different document formats. So far, all of these aspects of the user interface have been provided in different ways on Windows. For example, a developer needs to use Windows Forms to build a Windows GUI, or HTML/ASPX/Applets/JavaScript etc. to build a web interface,Windows Media Player or software such as Adobe's Flash Player for displaying video etc. The challenge for developers is to build a coherent user interface for different kinds of clients using diverse technologies isn't a simple job.

A primary goal of WPF is to address this challenge! By offering a consistent platform for these entire user interface aspects, WPF makes life simpler for developers. By providing a common foundation for desktop clients and browser clients, WPF makes it easier to build applications.

What contemporary computing problems WCS solves?


WCS provides an entirely new approach to managing digital identities. It helps people keep track of their digital identities as distinct information cards. If a Web site accepts WCS logins, users attempting to log in to that site will see a WCS selection. By choosing a card, users also choose a digital identity that will be used to access this site. Rather than remembering a plethora of usernames and passwords, users need only recognize the card they wish to use. The identities represented by these cards are created by one or more identity providers. These identities will typically use stronger cryptographic mechanisms to allow users to prove their identity. With this provider, users can create their own identities that don't rely on passwords for authentication.

What are WCF features and what communication problems it solves?


WCF provides strong support for interoperable communication through SOAP. This includes support for several specifications, including WS-Security, WS-ReliableMessaging, and WS-AtomicTransaction. WCF doesn't itself require SOAP, so other approaches can also be used, including optimized binary protocol and queued messaging using MSMQ. WCF also takes an explicit service-oriented approach to communication, and loosens some of the tight couplings that can exist in distributed object systems, making interaction less error-prone and easier to change. Thus, WCF addresses a range of communication problems for applications. Three of its most important aspects that clearly stand out are:

Unification of Microsoft's communication technologies.
Support for cross-vendor interoperability, including reliability, security, and transactions.
Rich support for service orientation development

What Improvements does WCF offers over its earlier counterparts?


A lot of communication approaches exist in the .NET Framework 2.0 such as ASP.NET Web Services, .NET Remoting, System.Messaging supporting queued messaging through MSMQ,Web Services Enhancements (WSE) - an extension to ASP.NET Web Services that supports WS-Security etc. However, instead of requiring developers to use a different technology with a different application programming interface for each kind of communication, WCF provides a common approach and API.

What is the .NET Framework 3.0 (formerly WinFX)?


The .NET Framework 3.0 is Microsoft's managed code programming model. It is a superset of the .NET Framework 2.0, combining .NET Framework 2.0 components with new technologies for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes. In addition to the .NET Framework 2.0, it includes Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), and Windows CardSpace.

What happens to the WinFX technologies?

The WinFX technologies will now be released under the name .NET Framework 3.0. There are no changes to the WinFX technologies or ship schedule — the same technologies you're familiar with now simply have a new name.

How does the .NET Framework 3.0 relate to the .NET Framework 2.0?

The .NET Framework 3.0 is an additive release to the .NET Framework 2.0. The .NET Framework 3.0 adds four new technologies to the .NET Framework 2.0: Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), and Windows CardSpace. There are no changes to the version of the .NET Framework 2.0 components included in the .NET Framework 3.0. This means that the millions of developers who use .NET today can use the skills they already have to start building .NET Framework 3.0 applications. It also means that applications that run on the .NET Framework 2.0 today will continue to run on the .NET Framework 3.0.

Will the name change be reflected in any of the existing .NET Framework 2.0 APIs, assemblies, or namespaces?


There will be no changes to any of the existing .NET Framework 2.0 APIs, assemblies, or namespaces. The applications that you've built on .NET Framework 2.0 will continue to run on the .NET Framework 3.0 just as they have before.

Which version of the Common Language Runtime (CLR) does the .NET Framework 3.0 use?


The .NET Framework 3.0 uses the 2.0 version of the CLR. With this release, the overall developer platform version has been decoupled from the core CLR engine version. We expect the lower level components of the .NET Framework such as the engine to change less than higher level APIs, and this decoupling helps retain customers' investments in the technology.

Why is the .NET Framework 3.0 a major version number of the .NET Framework if it uses the .NET Framework 2.0 runtime and compiler?


The new technologies delivered in the .NET Framework 3.0, including WCF, WF, WPF, and CardSpace, offer tremendous functionality and innovation, and we wanted to signal that with a major release number.

What is .Net Framework 3.0?



The Microsoft .NET Framework 3.0 (formerly WinFX), is the new managed code programming model for Windows.

It combines the power of the .NET Framework 2.0 with four new technologies: Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), Windows Workflow Foundation (WF), and Windows CardSpace (WCS, formerly "InfoCard").

Use the .NET Framework 3.0 today to build applications that have visually compelling user experiences, seamless communication across technology boundaries, the ability to support a wide range of business processes, and an easier way to manage your personal information online. Now the same great WinFX technology you know and love has a new name that identifies it for exactly what it is – the next version of Microsoft’s development framework. This change does not affect the release schedule of the .NET Framework 3.0 or the technologies included as a part of the package.

What is CTS (Common Type System)?


Common Type System Overview

Classification of Types

The common type system supports two general categories of types, each of which is further divided into subcategories:

· Value types

Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations.

· Reference types

Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.

Managed Execution Process

Managed Execution Process

The managed execution process includes the following steps:

1. Choosing a compiler.

To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.

2. Compiling your code to Microsoft intermediate language (MSIL).

Compiling translates your source code into MSIL and generates the required metadata.

3. Compiling MSIL to native code.

At execution time, a just-in-time (JIT) compiler translates the MSIL into native code. During this compilation, code must pass a verification process that examines the MSIL and metadata to find out whether the code can be determined to be type safe.

4. Running code.

The common language runtime provides the infrastructure that enables execution to take place as well as a variety of services that can be used during execution.

Common Language Runtime Overview


Compilers and tools expose the runtime's functionality and enable you to write code that benefits from this managed execution environment. Code that you develop with a language compiler that targets the runtime is called managed code; it benefits from features such as cross-language integration, cross-language exception handling, enhanced security, versioning and deployment support, a simplified model for component interaction, and debugging and profiling services.

To enable the runtime to provide services to managed code, language compilers must emit metadata that describes the types, members, and references in your code. Metadata is stored with the code; every loadable common language runtime portable executable (PE) file contains metadata. The runtime uses metadata to locate and load classes, lay out instances in memory, resolve method invocations, generate native code, enforce security, and set run-time context boundaries.

The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data. Garbage collection eliminates memory leaks as well as some other common programming errors. If your code is managed, you can use managed data, unmanaged data, or both managed and unmanaged data in your .NET Framework application. Because language compilers supply their own types, such as primitive types, you might not always know (or need to know) whether your data is being managed.

The common language runtime makes it easy to design components and applications whose objects interact across languages. Objects written in different languages can communicate with each other, and their behaviors can be tightly integrated. For example, you can define a class and then use a different language to derive a class from your original class or call a method on the original class. You can also pass an instance of a class to a method of a class written in a different language. This cross-language integration is possible because language compilers and tools that target the runtime use a common type system defined by the runtime, and they follow the runtime's rules for defining new types, as well as for creating, using, persisting, and binding to types.

As part of their metadata, all managed components carry information about the components and resources they were built against. The runtime uses this information to ensure that your component or application has the specified versions of everything it needs, which makes your code less likely to break because of some unmet dependency. Registration information and state data are no longer stored in the registry where they can be difficult to establish and maintain. Rather, information about the types you define (and their dependencies) is stored with the code as metadata, making the tasks of component replication and removal much less complicated.

Language compilers and tools expose the runtime's functionality in ways that are intended to be useful and intuitive to developers. This means that some features of the runtime might be more noticeable in one environment than in another. How you experience the runtime depends on which language compilers or tools you use. For example, if you are a Visual Basic developer, you might notice that with the common language runtime, the Visual Basic language has more object-oriented features than before. Following are some benefits of the runtime:

· Performance improvements.

· The ability to easily use components developed in other languages.

· Extensible types provided by a class library.

· New 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 and custom attributes.

If you use Microsoft® Visual C++® .NET, you can write managed code using Visual C++, which provides the benefits of a managed execution environment as well as access to powerful capabilities and expressive data types that you are familiar with. Additional runtime features include:

· Cross-language integration, especially cross-language inheritance.

· Garbage collection, which manages object lifetime so that reference counting is unnecessary.

· Self-describing objects, which make using Interface Definition Language (IDL) unnecessary.

· The ability to compile once and run on any CPU and operating system that supports the runtime.

You can also write managed code using the C# language, which provides the following benefits:

· Complete object-oriented design.

· Very strong type safety.

· A good blend of Visual Basic simplicity and C++ power.

· Garbage collection.

· Syntax and keywords similar to C and C++.

· Use of delegates rather than function pointers for increased type safety and security. Function pointers are available through the use of the unsafe C# keyword and the /unsafe option of the C# compiler (Csc.exe) for unmanaged code and data.

XSL Languages

XSL Languages

It started with XSL and ended up with XSLT, XPath, and XSL-FO.


It Started with XSL

XSL stands for EXtensible Stylesheet Language.

The World Wide Web Consortium (W3C) started to develop XSL because there was a need for an XML-based Stylesheet Language.


CSS = HTML Style Sheets

HTML uses predefined tags and the meaning of the tags are well understood.

The <table> element in HTML defines a table - and a browser knows how to display it.

Adding styles to HTML elements is simple. Telling a browser to display an element in a special font or color, is easy with CSS.


XSL = XML Style Sheets

XML does not use predefined tags (we can use any tag-names we like), and the meaning of these tags are not well understood.

A

element could mean an HTML table, a piece of furniture, or something else - and a browser does not know how to display it.

XSL describes how the XML document should be displayed!


XSL - More Than a Style Sheet Language

XSL consists of three parts:

  • XSLT - a language for transforming XML documents
  • XPath - a language for navigating in XML documents
  • XSL-FO - a language for formatting XML documents

XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.

XPath is a language for navigating in XML documents.


What You Should Already Know

Before you continue you should have a basic understanding of the following:

  • HTML / XHTML
  • XML / XML Namespaces
  • XPath


What is XSLT?

  • XSLT stands for XSL Transformations
  • XSLT is the most important part of XSL
  • XSLT transforms an XML document into another XML document
  • XSLT uses XPath to navigate in XML documents
  • XSLT is a W3C Recommendation

XSLT = XSL Transformations

XSLT is the most important part of XSL.

XSLT is used to transform an XML document into another XML document, or another type of document that is recognized by a browser, like HTML and XHTML. Normally XSLT does this by transforming each XML element into an (X)HTML element.

With XSLT you can add/remove elements and attributes to or from the output file. You can also rearrange and sort elements, perform tests and make decisions about which elements to hide and display, and a lot more.

A common way to describe the transformation process is to say that XSLT transforms an XML source-tree into an XML result-tree.


XSLT Uses XPath

XSLT uses XPath to find information in an XML document. XPath is used to navigate through elements and attributes in XML documents.


How Does it Work?

In the transformation process, XSLT uses XPath to define parts of the source document that should match one or more predefined templates. When a match is found, XSLT will transform the matching part of the source document into the result document.

Nearly all major browsers have support for XML and XSLT.


Mozilla Firefox

As of version 1.0.2, Firefox has support for XML and XSLT (and CSS).


Mozilla

Mozilla includes Expat for XML parsing and has support to display XML + CSS. Mozilla also has some support for Namespaces.

Mozilla is available with an XSLT implementation.


Netscape

As of version 8, Netscape uses the Mozilla engine, and therefore it has the same XML / XSLT support as Mozilla.


Opera

As of version 9, Opera has support for XML and XSLT (and CSS). Version 8 supports only XML + CSS.


Internet Explorer

As of version 6, Internet Explorer supports XML, Namespaces, CSS, XSLT, and XPath.

Version 5 is NOT compatible with the official W3C XSL Recommendation.

Example study: How to transform XML into XHTML using XSLT.

The details of this example will be explained in the next chapter.


Correct Style Sheet Declaration

The root element that declares the document to be an XSL style sheet is or .

Note: and are completely synonymous and either can be used!

The correct way to declare an XSL style sheet according to the W3C XSLT Recommendation is:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

or:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

To get access to the XSLT elements, attributes and features we must declare the XSLT namespace at the top of the document.

The xmlns:xsl="http://www.w3.org/1999/XSL/Transform" points to the official W3C XSLT namespace. If you use this namespace, you must also include the attribute version="1.0".


Start with a Raw XML Document

We want to transform the following XML document ("cdcatalog.xml") into XHTML:

  
    Empire Burlesque
    Bob Dylan
    USA
    Columbia
    10.90
    1985
  
.
.
.

Viewing XML Files in Firefox and Internet Explorer: Open the XML file (typically by clicking on a link) - The XML document will be displayed with color-coded root and child elements. A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure. To view the raw XML source (without the + and - signs), select "View Page Source" or "View Source" from the browser menu.

Viewing XML Files in Netscape 6: Open the XML file, then right-click in XML file and select "View Page Source". The XML document will then be displayed with color-coded root and child elements.

Viewing XML Files in Opera 7: Open the XML file, then right-click in XML file and select "Frame" / "View Source". The XML document will be displayed as plain text.


Create an XSL Style Sheet

Then you create an XSL Style Sheet ("cdcatalog.xsl") with a transformation template:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  
    

My CD Collection

    
    
      
      
    
    
    
      
      
    
    
    
TitleArtist
  
  


Link the XSL Style Sheet to the XML Document

Add the XSL style sheet reference to your XML document ("cdcatalog.xml"):

  
    Empire Burlesque
    Bob Dylan
    USA
    Columbia
    10.90
    1985
  
.
.
.

If you have an XSLT compliant browser it will nicely transform your XML into XHTML.

XSLT Element


An XSL style sheet consists of one or more set of rules that are called templates.

Each template contains rules to apply when a specified node is matched.


The Element

The element is used to build templates.

The match attribute is used to associate a template with an XML element. The match attribute can also be used to define a template for the entire XML document. The value of the match attribute is an XPath expression (i.e. match="/" defines the whole document).

Ok, let's look at a simplified version of the XSL file from the previous chapter:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 
   

My CD Collection

   
     
       
       
     
     
       
       
     
   
TitleArtist
..
 
 

Since an XSL style sheet is an XML document itself, it always begins with the XML declaration: .

The next element, , defines that this document is an XSLT style sheet document (along with the version number and XSLT namespace attributes).

The element defines a template. The match="/" attribute associates the template with the root of the XML source document.

The content inside the element defines some HTML to write to the output.

The last two lines define the end of the template and the end of the style sheet.

The Element

The element can be used to extract the value of an XML element and add it to the output stream of the transformation:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 
   

My CD Collection

   
     
       
       
     
     
      
      
     
   
TitleArtist
 
 

Note: The value of the select attribute is an XPath expression. An XPath expression works like navigating a file system; where a forward slash (/) selects subdirectories.

The Element

The XSL element can be used to select every XML element of a specified node-set:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  
    

My CD Collection

    
      
        
        
      
      
      
        
        
      
      
    
TitleArtist
  
  

Note: The value of the select attribute is an XPath expression. An XPath expression works like navigating a file system; where a forward slash (/) selects subdirectories

Where to put the Sort Information

To sort the output, simply add an element inside the element in the XSL file:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  
    

My CD Collection

    
      
        
        
      
      
      
      
        
        
      
      
    
TitleArtist
  
  

Note: The select attribute indicates what XML element to sort on.

The Element

To put a conditional if test against the content of the XML file, add an element to the XSL document.

Syntax

expression">
  ...
  ...some output if the expression is true...
  ...


Where to Put the Element

To add a conditional test, add the element inside the element in the XSL file:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  
    

My CD Collection

    
      
        
        
      
      
      
        
          
          
        
      
      
    
TitleArtist
  
  

Note: The value of the required test attribute contains the expression to be evaluated.

The Element

Syntax

  expression">
    ... some output ...
  
  
    ... some output ....
  


Where to put the Choose Condition

To insert a multiple conditional test against the XML file, add the , , and elements to the XSL file:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  
  
    

My CD Collection

    
      
        
        
      
      
      
        
        
          
            
          
          
            
          
        
      
      
    
TitleArtist
            
  
  

The Element

The element applies a template to the current element or to the current element's child nodes.

If we add a select attribute to the element it will process only the child element that matches the value of the attribute. We can use the select attribute to specify the order in which the child nodes are processed.

Look at the following XSL style sheet:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

My CD Collection

 

 

Title: 

Artist: