Entity Framework has the following advantages:
- With its excellent prototypes, it is possible to write
object-oriented programs.
- By allowing auto-migration, it is simple to create a database or
modify it.
- It simplifies the developer's job by reducing the code length with
the help of alternate commands.
- It reduces development time, and development cost, and provides
auto-generated code.
- A unique syntax (LINQ / Yoda) is provided for all object queries,
whether they are databases or not.
- It enables the mapping of multiple conceptual models to a single
storage schema.
- Business objects can be mapped easily (with drag & drop
tables).
Explain the advantages of the Entity Framework.
- If the developer does not use raw SQL codes, things can become
complicated sometimes.
- It is a slower form of the Object Relational Mapper.
- For a big domain model, it's not ideal.
- Some RDMS do not offer this feature.
- EF's main drawback is its lazy loading
- This requires a non-traditional approach to handling data that
isn't available for every database.
- Since the data migration functionality is weak, it isn't fully
effective in practice.
Mention in what all scenarios Entity Framework can be applicable?
- Entity Framework can be applicable in three scenarios.
- If you have existing
database already or 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
Explain what does .edmx file contains?
.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 an object maps with SQL tables. It is divided into three
categories SSDL, CSDL, and MSL.
Mention what is CSDL, SSDL, and MSL sections in an EDMX file?
- CSDL: It stands for Conceptual Schema Definition
Language, it is the conceptual abstraction which is exposed to the
application
- SSDL: It stands for Storage Schema Definition Language,
it defines the mapping with our RDBMS data structure
- MSL: It stands for Mapping Schema Language, it connects
the SSDL and CSDL
How can you enhance the performance of Entity Framework?
- To enhance the performance of Entity Framework, you have to follow
the following steps
- Try to avoid putting
all the DB objects into one single-entity model
- Disable change tracking
for the 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 the appropriate collection.
- Wherever needed use
compiled query.
- Avoid using Views and
Contains.
- While binding data to a grid or paging, retrieve only required no of records.
- Debug and Optimize LINQ
query.
Explain how you can load related entities in EF (Entity Framework)?
You can load related entities or data in EF in three ways
- Eager Loading
- Lazy Loading
- Explicit Loading
Mention what is Code First Approach and Model First Approach in Entity
Framework?
n Entity Framework,
- Model First Approach: In this approach, we create entities and relationships directly on the design surface of EDMX.
- Code Approach: For the code approach, we avoid working with the
visual designer or entity framework.
Explain Lazy loading, Eager Loading, and Explicit Loading?
- 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: Explicit
loading takes place when you have disabled Lazy loading, and you still
want lazy loading. For this, we have to call the load method on the
related entities.
Mention what are the various methods provided by the DataSet object to
generate XML?
To generate XML various DataSet
objects include
- ReadXml (): It reads XML documents into the DataSet object.
- GetXml (): It returns a string consisting of an XML document
- Write XML (): It writes XML data to disk.
No comments:
Post a Comment