Entity framework interview questions and answers

$8.00


This document helps the reader prepare for entity framework interview questions. It also includes the answers, with detailed explanations and source code.

What's included in the purchase

PDF file with the following:

  • Answer to the interview question, Design a code first data model which has a Project class that can contain a bunch of tasks.
  • Answer to the interview question, Using the Code First model, how can I mark a field/property as the primary key if it does not follow the code first convention?
  • Answer to the interview question, When you have an annotated property as Primary key in a table, how do you enable foreign key relationship from another table?
  • Answer to the interview question, How do you mark a property as required? For example, For a Project, the Name is a required field.
  • Answer to the interview question, How do you enforce a field to have a minimum and maximum number of characters? For example, the Description on a Project should be a minimum of 10 and a maximum of 500?
  • Answer to the interview question, Define a property in project class named ProjectCode that is not mapped to the database. ProjectCode is internally calculated as a combination of project ID and Title. 
  • Answer to the interview question, If your domain entities are defined using a set of classes, how can you combine them in EF to form one complete entity?
  • Answer to the interview question, How can you tell EF to have a different table or column name than that defined for the class?
  • Answer to the interview question, For a date time property, how can you tell EF to automatically compute and insert the current date time when the row is created?
  • Answer to the interview question, When two tables have multiple relationships (for example, a task is created by employee 1 and updated by employee 2), who do you indicate which relationships go with which property?
  • Answer to the interview question, Using the DbContext API’s in Entity Framework 4.1, explain the concept of eager loading related entities.
  • Answer to the interview question, How can we eagerly load multiple levels of related entities? 
  • Answer to the interview question, How can you disable lazy loading of related entities accessed via navigation properties?
  • Answer to the interview question, How can you disable lazy loading for all entities? 
  • Answer to the interview question, What are the different ways to configure database name?
  • Answer to the interview question, Write code to demonstrate enum usage in entity framework.
  • Source code for all examples and questions

Length

28 pages

Difficulty

Advanced

About the author 

The author has over 15 years of experience as architect and engineering director for several Fortune 500 companies.  He loves programming interviews and writes frequently on the topic.  Here are some additional details about the author:

- Expert in C#, .NET, ASP.NET, XML, XSLT, enterprise JAVA and client side technologies

- Extensive experience in C, C++, VB.Net, ASP, UML, Design Patterns and SEO

- Proficient in major databases including Microsoft SQL Server and Oracle

- In-depth knowledge of cloud providers including Amazon AWS and Microsoft Azure

- Clear understanding of all 3 major mobile platforms – iOS, Android and Windows Phone