What is Entity Framework?

Entity Framework in asp.net is the enhancement of ADO.net which provides the strong mapping facilities. It is an ORM (Object Relational Mapping) which helps to interact with Relational Database using object. It provides the higher level of abstraction.

How many Type of approaches available in Entity Framework?

There are 3 approaches in Entity Framework

Database First

Database first is the approach in which our database has already generated. And using this database we create our Model and code in entity framework.

Model First

In Model first we create designer (model) first. If database not exist then we can create database using this designer

Code First

In code first we create code file first and then if database not exist then database will be created automatically at runtime using this code.

What is difference between LINQ to SQL and Entity Framework?

The major difference between LINQ to SQL and Entity Framework is that LINQ to SQL support only SQL Server but Entity Framework supports almost all Relational Database.

LINQ to SQL provides limited mapping facility but entity framework provides full mapping facility.

What are three Schema Definition Language in EDM?

SSDL (Storage Schema Definition Language)

It stores the schema of database which we created

CSDL (Conceptual Schema Definition Language)

It stores the schema of cs file which generated for each table of database. This files defines the properties created for that table and all the relationship.

ML (Mapping Language) or C-S M Mapping

It stores the mapping of SSDL and CSDL.

What is ObjectContext class in Entity Framework?

ObjectContext is the class which helps us to perform Insert, Update, Delete and create in Entity Framework.

This class is available in System.Data.Entity namespace.

Is it necessary to have EDMX file in code first approach

No, it is not necessary.

How can we specify key column in Code first approach.

By assigning a [key] attribute on property.

For Example
public int emp_id { get; set; }

Which namespace we use in Code first approach to use [key] attribute


Which namespace we use in Code first approach to use [Foreign key] attribute


How to make changes in database using code first approach

To know the answer of this question kindly Click Here

Share your questions and topics here.