.Net Interview Questions and Answers

Search:

What are navigation properties in Entity framework?(ADO.NET Entity framework interview questions)

By : Shiv Prasad Koirala | Oct 28th, 2013 | Views : 4294 | Comments : 0 Bookmark and Share

This question is taken from the book .NET interview question published by Bpbpulications.

 

Navigation properties help to navigate from one entity to the other entity. For instance consider the below example in which we have two entities customer and address and one customer has multiple address objects.

 

Now we would like to have a facility where at any given moment we would like to browse from a given customer object to the addresses collection and from address object to the customer.

 

If you open the entity designer you would notice "Navigation" properties as shown below. The navigation properties are automatically created from the primary and foreign key references.


 

                            

 

So now because of those navigation properties we can browse from Customer to addresses object , look at the below code.

 

Customer Cust =  oContext.Customers.ToList()[0];


// From customer are browsing addresses

List

Addresses = Cust.Addresses.ToList
();

 

You can also go vice versa. In other words from the address object you can reference the customer object as shown in the below code.

 

Address myAddress = Addresses[0];

 

// From address we can browse customer

Customer cus = myAddress.Customer;

 

We are thankful to questpond.com to provide the above ADO.NET Navigation interview question with answer.


Below is a great ADO.NET Entity framework interview question video created by www.questpond.com which shows how to do CRUD using Entity framework.


 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

Article Categories

Learn in Hindi