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)
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
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.
精彩评论