Entity Framework Question:

What is DefiningQuery in Entity Framework?

Tweet Share WhatsApp

Answer:

A defining query allows you to execute a native SQL statement that is specified in the DefiningQuery element in the EntitySet element in the SSDL.



A defining query is commonly used to provide functionality similar to that provided by a database view, but this native SQL statement will be in the .edmx file, not in the database. The entityset in CSDL is used to surface data exposed by the defining query.



So here, we will see how we can execute same SQL using DifiningQuery which we used in database view in previous chapter and get the same functionality as database view.

We will perform following three steps to create and use DefiningQuery:

Add DefiningQuery in SSDL
Add EntitySet in CSDL
Mapping between Conceptual and Storage EntitySets

Download ADO.Net Entity Framework PDF Read All 28 ADO.Net Entity Framework Questions
Previous QuestionNext Question
What is Entity Framework?What is Entity Graph?