user380719
user380719

Reputation: 9903

What is the equivalent of DataContext in entity framework?

Linq to SQL has this very simple model: DataContext and attributes [Table] and [Column] and no need for a config file.

But I understand Linq2SQL does not have a future.

How do I do something equivalent in entity framework?

(Equivalent = no config file)

Upvotes: 0

Views: 608

Answers (2)

Eranga
Eranga

Reputation: 32447

In EF 4.1 Code-First you can configure your mapping in a fluent way as opposed to a config file.

It is convention based so it will infer lot of thing from your model (eg: Table column are automatically mapped to properties if both names match).EF Code First Model

Upvotes: 2

Praneeth
Praneeth

Reputation: 2547

In EF also we create a context from edmx file through which you can access all the entities(tables in Database). Refer to this article in msdn.

It also adds the connection string to the config file. If you just want to use entities then you dont need a config entry.

But EF is used with database operations most of the time.

Upvotes: 1

Related Questions