ADO.NET( ActiveX Data Objects) is the new database technology used in Dot Net platform. ADO.Net is the next step in the evolution of Microsoft ActiveX Data Object(ADO). it does not share the same programming model, but shares the much of the ADO functionality. the ADO.NET is a marketing term that covers the classes that expose the data access service of the. Net framework. ADO.Net is a natural evolution of ADO and is build around N-tier application development. ADO.Net has been created with XML as its core.
Data Storage is a method of storing specific items that together constitute a unit of information. individual data item themselves are of little use; they become valuable resources only when put into context with other data items.
The following describes different methods of data storage.
In this method, data has no logical order to store.
For example Simple memos.
In this method, data is separated into units, but the units are organized strictly by their order.
For example-comma separated value(CSV) files. or tab separated files, Microsoft Excel spreadsheet, Microsoft exchange files, Microsoft active directory files, indexed sequential access method files.
in this method, data is organized in a tree-structured, with nodes that contain other nodes.
for example -XML data documents.
In this form, data is organized in tables, with columns containing a specific type of data and rows containing a single record. Tables can be related over columns with identical data.
For example-Microsoft SQL server and Microsoft Access Database, Oracle database.
In this method, data is organized as objects.
ADO.NET can support all of the data formats described above.
CONNECTED VS DISCONNECTED MODE
For much of the history of computers, there was only connected environment available. With the advent of the internet, disconnected work scenarios have become commonplace, and with the increasing use of handheld devices, disconnected scenario are are becoming nearly universal. Laptop, notebook and other portable computers allow you to use applications when you are disconnected from servers of the database.
In many situations, people do not work entirely in a connected or disconnected environment, but rather in an environment that combines the two approaches.
A connected environment is one in which a user or an application is constantly connected to a data source.
A connected scenario offers the following advantages:
- A secure environment is easier to maintain.
- Concurrency is easier to control.
- Data is more likely to be current that in other scenarios.
A connected scenario has the following disadvantages:
- It must have a constant connection.
The Second Type of environment of ADO.NET is a disconnected environment. Disconnected Environment is one in which a user or an application is not constantly connected to a source of data. Various mobiles user who basically works with laptop computers are the primary users in the disconnected environment. users can take a subset of data with them on a disconnected computer, and then merge changes back into the central data source.
A Disconnected environment provides the following advantage-
you can work at any time that is convenient for you. and you can connect to a data source. at any time to process a request. other users can use the connection.
a Disconnected environment improves the scalability and performance of applications.
A disconnected environment has the following disadvantage.
• data is not always up to date.
• change conflicts can occur and you must resolve it.
ADVANTAGES OF ADO.NET
ADO.net provides the following advantage over the data access models and components.
ADO.Net basically uses XML as the format for transmitting data from a data source to a local in-memory copy of the data.
When an increasing number of user work with an application, the increased use can strain resources. by using N-tier application the logic across additional tiers. The ADO.NET architecture basically uses local in-memory caches. to hold copies of data, making it easy for additional tiers to trade information.
the ADO.NET programming model uses strongly typed data. strongly types data make code more concise and easier to write because Microsoft visual studio .net provides statement completion.
ADO.NET helps you to provide costly data type conversation because of its use of a strong type of data.
The ADO.NET programming model encourages programmers to conserve system resources for applications that run over the web because data is held locally in in-memory caches. There is no need to retain data source or maintain active database connection for extended periods.
ADO.NET Data Providers
- SqlClient (System.Data.SqlClient)
- OleDb (System.Data.OleDb)
- Odbc (System.Data.Odbc)
- OracleClient (System.Data.OracleClient)
ADO.NET Entity Framework
- LINQ to Entities
- Typed ObjectQuery
- EntityClient (System.Data.EntityClient)
- LINQ to SQL
ADO.NET has various component. Basically, DATASET is the main component of disconnected architecture The DATASET class is the central component of the disconnected architecture.
-A DATASET can be populated from either a database or an XML stream.
-In DATASET the original source of the data is basically immaterial From the perspective of the user of the dataset.
-A consistent programming model basically uses for all application interaction with the DATASET.
-ADO.Net basically provides a different type of arch The second Key Component of Ado.net architecture is the .NET Data Provider, which provides access to the database, and we can use it to populate a DATASET.
-We can also use data provider directly by an application to support a connected mode of database access.
.NET Data Provider:
. The most important part of ADO.NET is DATA provider. A DOT NET data provider basically use for connecting to a database.
-The DOT NET DATA provider basically provides classes. we can use these classes to execute commands and to retrieve results.
-Basically, these Results are either used directly by the application or else they are placed in a Dataset. else they are placed in a Dataset.
A .NET data provider implements four key interfaces:
-IDbConnection: The major use of DATA provider is to Establish a connection to a specific or particular data source.
–IDbCommand: IDbCommand DATA Provider use to Execute a command at a data source.
-IDataReader: IDataReader basically provides an efficient way to read a stream of data from a data source. the data access provided by a data reader is forward-only and read-only.
-IDbDataAdapter is basically using to populate a Dataset from a data source.
- The architecture of The ADO.NET focus on the specification of these interfaces and we can create different implementations to a facilitate working with different data sources.
-One another work of A .NET data provider is analogous to an OLE DB provider. The OLE DB provider implements COM(Component Object Model) interfaces, and a .NET data provider implements .NET interfaces.
Namespaces for ADO.NET classes include the following:
-System.Data consist of classes that constitute most of the ADO.NET architecture.
-System.Data.OleDB contains classes that basically provide database access using the SQL Server data provider.
-System.Data.SqlClient contains classes that provide database access using the OLE DB data provider.
-System.Data.SqlTypes contains classes that represent data types used by SQL server.
-System.Data.Common contains classes that data providers share.
-System.Data.EntityClient contains classes supporting the ADO.NET Entity Framework.
You now have an overview of ADO.NET that ADO.NET can be used in your Microsoft Visual C# applications with the help of a different type of mode. The .NET Framework basically includes the DataSet object to work directly with the data. The object gives you the flexibility and control to represent the data in any way needed. In ADO.NET it is very easy to identify that the object can bound easily to controls in either Windows Forms or Web Forms to tie the controls and datasets together. This allows you to build data entry screens quickly.
Basically, the .NET Framework also contains two type of data providers that basically use to access data sources. One is the OLE DB .NET Data Provider and second is the SQL Server .NET Data Provider. Using the Connection, Command, DataReader, and DataAdapter objects included in each data provider, you can get complete access to your data.