Kevin
Kevin

Reputation: 1950

What is the difference between a sql table adapter and entity framework model?

They both seem to create classes based on a database schema. Why would you use the entity framework model over a table adapter?

They both allow me to easily drag a sql table onto a surface in Visual Studio, after which a class and all the code is generated which allows me to automatically create/update/delete records.

I know the entity framework is the clear choice, I just don't understand why.

Thanks!

Upvotes: 6

Views: 2549

Answers (1)

VinayC
VinayC

Reputation: 49245

Data-Set, Data-table and Data-row offers relational API - they are your RDBMS entities mapped as objects in .NET world. You can't have inheritance. You cannot have graph like structures.

EF on the other hand, allows you to model your objects as you want them to and then map that to RDBMS schema so that it would manage the persistence part. With EF, you can work with the conceptual (domain) model rather than relational model. For example, a EF entity might be projection from multiple tables or you can have several entities built upon a single table (e.g. inheritance scenario).

Upvotes: 4

Related Questions