- Entity Framework (EF) in an ORM (Object Relational Mapping) framework, similar to Hibernate/NHibernate. EF6 is open source and is distributed as complete Nuget package. Predecessors to EF include DataSet (ADO.Net), and LINQ to SQL (only worked with SQL Server). EF has a provider model and works with any relational database with valid EF provider.
- EF takes data out of the database and transfers data to class objects used in an application. EF takes modified data out of class objects and saves it into database columns. These class objects serve as data containers and are no more than POCOs (Plain old C# objects).
- EF figures out the mapping between the POCO properties and DB table columns. EF keeps track of changes made to POCO instances. EF also handles entity relationships and foreign keys. You can also query DB Views and invoke DB Stored Procedures.
- EF provides robust designers to create data models and to automatically generate POCO classes. EF even generates database scripts for initial database creation and subsequent migrations/updates.
- The use of EF designers is optional. You can totally design your database and code separately and independently.
Installing
Package Console Manager (Nuget)
install-package entityframework [-version 6.0.0]
uninstall-package entityframework
update-package entityframework
EF 6 Assemblies
- EntityFramework
- EntityFramework.SqlServer (other providers)
- System.ComponentModel.Annotations
EF Configuration
- App.Config has a section for the EF
- Defaults for the connection factory can be set in this section