0

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)

user380719
  • 9,663
  • 15
  • 54
  • 89

2 Answers2

2

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

Eranga
  • 32,181
  • 5
  • 97
  • 96
  • Does it support view? What about if my table doesn't have a key? – user380719 Jun 01 '11 at 05:03
  • it does support views. for tables without keys please look at [link]http://stackoverflow.com/questions/3996782/entity-framework-table-without-primary-key – Eranga Jun 01 '11 at 05:13
1

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.

Praneeth
  • 2,527
  • 5
  • 30
  • 47