Ado.Net Interview Questions And Answers Codeproject

(B) Can you give an overview of the ADO.NET architecture?

The most important concept in ADO.NET architecture is “Data Provider”. Data Provider provides access to data sources (SQL Server, Access, Oracle). In short, it provides an object to achieve functionalities like opening and closing connection, retrieve data, and update data. In the below figure, you can see the four main sections of a data provider:

  • Connection.
  • Command object (this is the object for using Stored Procedures).
  • Data Adapter (this object acts as a bridge between the data store and the dataset).
  • Data Reader (this object reads data from the data store in forward only mode).
  • DataSet object represents disconnected and cached data. If you see the diagram, it is not in direct connection with the data store (SQL Server, Oracle, etc.) rather it talks with the data adapter, who is responsible for filling the dataset. The dataset can have one or more datatables and relations.
  • The DataView object is used to sort and filter data in the datatable.
  • Note: This is one of the poular questions in .NET interviews. Just paste the picture in your mind and during the interview try to refer to the .

    What is pluralize and singularize in the Entity Framework dialog box?

    “Pluralize” and “Singularize” give meaningful naming conventions to objects. In simple words it says do you want to represent your objects with the below naming convention:

  • One Customer record means “Customer” (singular).
  • Lot of customer records means “Customer’s” (plural, watch the “s”)
  • If you select the below checkbox, Entity Framework generates a naming convention which adheres to plural and singular coding conventions.

    Can you explain lazy loading in a detailed manner?

    Lazy loading is a concept where we load objects on demand rather than loading everything in one go. Consider a situation where you have 1 to many relationships between the Customer and Address objects. Now let’s say you are browsing the customer data but you do not want address data to be loaded at that moment. But the time you start accessing the address object you would like to load address data from the database.

    Entity Framework has lazy loading behavior by default enabled. For instance, consider the below code. When we are doing a foreach on the Customer object, the Address object is not loaded. But the time you start doing foreach on the address collection, the Address object is loaded from SQL Server by firing SQL queries.

    So in simple words, it will fire a separate query for each address record of the customer, which is definitely not good for a large number of records. C#

    Question 1: What is ADO.NET?

    Answer 1: ADO stands for Active Data Object and ADO.NET is a set of .NET libraries for ADO.

    ADO.NET is a collection of managed libraries used by .NET applications for data source communication using a driver or provider:

  • Enterprise applications handle a large amount of data. This data is primarily stored in relational databases, such as Oracle, SQL Server, and Access and so on. These databases use Structured Query Language (SQL) for retrieval of data.
  • To access enterprise data from a .NET application, an interface was needed. This interface acts as a bridge between an RDBMS system and a .NET application. ADO.NET is such an interface that is created to connect .NET applications to RDBMS systems.
  • In the .NET framework, Microsoft introduced a new version of Active X Data Objects (ADO) called ADO.NET. Any .NET application, either Windows based or web based, can interact with the database using a rich set of classes of the ADO.NET library. Data can be accessed from any database using connected or disconnected architecture.
  • ADO.NET provides mainly the following two types of architectures:

    ADO.NET Namespaces

    Namespaces Description
    System.Data Contains the definition for columns, relations, tables, database, rows, views and constraints.
    System.Data.SqlClient Contains the classes that are used to connect to a Microsoft SQL Server database such as SqlCommand, SqlConnection, SqlDataAdapter.
    System.Data.Odbc Contains classes required to connect to most ODBC drivers. These classes include OdbcCommand,OdbcConnection.
    System.Data.OracleClient Contains classes such as OracleConnection,OracleCommand required to connect to an Oracle database.

    See for more detail:

    Dataset & Datareader in ADO.NET | C# and ADO.NET Interview Questions

    Related Posts

    Leave a Reply

    Your email address will not be published. Required fields are marked *