Questions & Answers
Questions & Answers
com/
ADO.NET entity framework is an ORM (Object Relational Mapping) framework developed by Microsoft.
It is an extension of ADO.NET that provides an automated mechanism to access and store data in the
database. With the help of ADO.NET, database can be accessed without much required programming
or code.
The main advantage of using Entity Framework or EF is that it generates code automatically for the
Model (Middle Layer), Mapping code and Data Access Layer. It reduces a lot of time during the
development process.
If you have existing database already or you want to build your database first than other parts
of the application
If your prime focus is your domain classes and then create the database from your domain
classes
If you want to design your database schema on the visual designer and create the classes and
database
.edmx file is an XML file, which declares a conceptual model, a storage model and the mapping
between these models. This file also consists the information that is used by ADO.NET entity data
model designer to render a model graphically. It consists of all the mapping details of how object
maps with SQL tables. It is divided into three categories SSDL, CSDL, and MSL.
To enhance the performance of Entity Framework, you have to follow the following steps
Try to avoid to put all the DB objects into one single entity model
Disable change tracking for entity if not needed
Reduce response time for the first request by using pre-generating Views
If not required try to avoid fetching all the fields
For data manipulation select appropriate collection
Wherever needed use compiled query
Avoid using Views and Contains
While binding data to grid or paging, retrieve only required no of records
Debug and Optimize LINQ query
T4 entity is important in Entity framework as it is the heart of entity framework code generation. It
reads the EDMX XML file and generate C# behind code.
Eager Loading
Lazy Loading
Explicit Loading
10) Mention what is Code First approach and Model First Approach in Entity Framework?
In Entity Framework,
Model First Approach: In this approach we create entities, relationships directly on the
design surface of EDMX.
Code Approach: For code approach we avoid working with the visual designer or entity
framework.
Lazy Loading: It is a process to delay the loading of related objects until it is required.
Eager Loading: It occurs when you query for an object and all of the related objects are also
returned. In eager loading, related objects are loaded automatically with its parent object
Explicit Loading: Explicitly loading takes place when you have disabled Lazy loading, and
you still want to lazy loading. For this, we have to call the load method on the related entities.
12) Mention what is the difference between ADO.NET and classic ADO?
13) What is the namespace used to include .NET Data provider for SQL server in .NET
code?
The namespace System.Data.SqlClient is used to include.NET data provider for SQL server in .NET
code.
14) Mention what are the various methods provided by the DataSet object to generate
XML?
In ADO.NET data-adapter class fetch data from the database, stores data in a dataset and reflects the
changes made in the dataset to the database. For all type of communication, data-adapter act as an
intermediary. Using the Fill() method, data-adapter fills data to a Data-table.
Connected data access: Through the DataReader objects of data-provider you can have
connected data access. It provides fast access to data, and it does not allow editing.
Dis-connected data access: Through the DataAdapter object, disconnected data access is
achieved. The dataset works independently of the database, and the data is editable.
Project
Test Management Business Analyst Ethical Hacking PMP
Management
Software
Jenkins Agile Testing RPA JUnit
Engineering