(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:
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:
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:
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: