What is difference between .edmx and .dbml file in linq?

LinqLinq to-SqlEntity FrameworkLinq to-Entities

Linq Problem Overview


What is difference between .edmx and .dbml file in linq?In VS 2008 which datasource is best choice where edmx or dbml?Any problem will arise using edmx file in VS 2008?Can i use edmx in VS-2008?

Linq Solutions


Solution 1 - Linq

edmx is the modeling file for Entity Framework.

dbml is the modeling file for Linq 2 Sql.

You should spend your time learning Entity Framework as Linq 2 Sql is deprecated.

Solution 2 - Linq

.edmx is the Entity Framework. .dbml is LINQ-to-SQL. While their general purpose is the same, they are entirely different frameworks. Entity Framework is newer and will probably be the best investment of your time to learn since I suspect that is where a lot of innovation is going to go.

Solution 3 - Linq

Both are introduced as latest technologies and at times a bit confusing when to use which. Entity Framework and LINQ to SQL have a lot in common but still different from each other in quite a few ways:

Entity Framework:

  1. Enterprise Development:
  2. Works with Conceptual model of database:
  3. Works with all data sources:
  4. ".EDMX" is created while using Entity Framework:

LINQ::

  1. Rapid Application Development:
  2. Works with objects in database:
  3. Mainly woks with SQL Server:
  4. ".dbml" is created while using LINQ to SQL:
    :

Entity Framework is more targeted towards Enterprise Development where the schema is usually optimized for storage considerations like performance consistency and partitioning. Entity Framework is designed around exposing an application-oriented data model that is loosely coupled and may differ from the existing database schema. For example, you can map a single entity (class) to multiple or map multiple entities to the same table. Entity Framework has “.edmx” (ADO.NET Entity Model) file when added in the application.

LINQ to SQL mainly has features to support Rapid Application Development against SQL Server. LINQ to SQL allows you to have a strongly typed view of your existing database schema. You can build LINQ queries over tables and return results as strong typed objects. LINQ to SQL has “.dbml”(LINQ to SQL) file when added in the application. You can use LINQ to SQL by decorating the existing classes with the attributes.

[Original source: https://parassanghani.blogspot.com/2011/01/entity-framework-vs-linq-to-sql.html]

Solution 4 - Linq

LINQ to SQL mainly has features to support Rapid Application Development against SQL Server. LINQ to SQL allows you to have a strongly typed view of your existing database schema. You can build LINQ queries over tables and return results as strong typed objects. LINQ to SQL has “.dbml”(LINQ to SQL) file when added in the application. You can use LINQ to SQL by decorating the existing classes with the attributes.

Solution 5 - Linq

I never understood the literature like definitions. Anyways the bottom line is L2S is lightweight and EF is heavy weight. Meaning L2S works only with SQLServer and EF works with many more.

Reference: Difference between L2S and EF

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser649802View Question on Stackoverflow
Solution 1 - LinqMikael ÖstbergView Answer on Stackoverflow
Solution 2 - LinqvcsjonesView Answer on Stackoverflow
Solution 3 - LinqYogeshView Answer on Stackoverflow
Solution 4 - Linqamit singhView Answer on Stackoverflow
Solution 5 - LinqWahid MasudView Answer on Stackoverflow