ADO.NET Entity Framework : http://msdn.microsoft.com/en-us/data/aa937723
Entity Framework Tutorials : http://www.asp.net/entity-framework/tutorials
Beginner Guide: http://msdn.microsoft.com/en-us/data/ee712907
Class 1 : Getting Started with the Entity Framework
Note: The hands-on lab is teaching
1. the usage of EntityDataSource control that bind to entity framework. Detail instruction about its properties, e.g. (where,order,group,select,includes and its event e.g.OnSelected event,navigation property update
2. QueryExtender control
3. Add store procedue to Entity framework
4. Dynamic Data functionality+ Adding Metadata to the Data Model (partial class)
Class 2: Continuing with the Entity Framework
Note: The hands-on lab is teaching
1. ObjectDataSource control, and implement n-tier design like Business-Logic, Data Access(Repository), Unit Test
2.the difference between a business-logic class that includes data-access logic without a repository and one that uses a repository.
Tips:
1) Bind vs Eval
The Bind expression makes the data available in GridView control properties in case you need to access the data in code. In the page you don't need to access this data in code, you can use Eval
2) EntityDataSource control performance concert:
change "ConnectionString="name=SchoolEntities" DefaultContainerName="SchoolEntities"" to ContextTypeName="ContosoUniversity.DAL.SchoolEntities"
3) lazy loading vs eager loading
When you use the ContextTypeName attribute of the EntityDataSource control, the Entity Framework automatically retrieves information for a navigation property when you access that property. This is called lazy loading.
But sometimes it'cs more efficient to retrieve the related data along with the entity itself in a single call to the database. This is called eager loading
4) TPH & TPT
This pattern of generating an entity inheritance structure from a single database table is called table-per-hierarchy (TPH) inheritance.
This pattern of generating an entity inheritance structure from separate tables for each type, with each separate table referring back to a table that stores data common to all types, is called table per type (TPT) inheritance.
5) IEnumerable vs IQueryable
The GetDepartments method returns an IEnumerable object rather than an IQueryable object in order to ensure that the returned collection is usable even after the repository object itself is disposed
6) DynamicField controls
use DynamicField controls so that you can take advantage of automatic data formatting and validation functionality.For these to work, you will have to call the EnableDynamicData method in the Page_Init event handler.
7) object context & object state manager in SaveChanges method
object context's object state manager, When you read an entity, the object context stores it in the object state manager and keeps track of whether that representation of the object is in sync with the database.Then when you call the SaveChanges method, the object context knows what to do in the database because the object state manager knows exactly what's different between the current state of the entity and the state of the database.
8)POCO (Plain Old CLR Objects)
Persistence Ignorance means that the business logic itself doesn't know about persistence. Or in other words, persistence is separated from logic.
9) class generate from *.edmx file
all model entity inheritance entity object
entities container inheritance object context
- each entity model is an object set
all partial class
10) edmx XML
default edmx class include meta data + designer position information
meta data include 3 sessions
so, connection strig meta data value has 3 parts: csdl,ssdl,msl => 3 files
11) T4: text template tranformation toolkit
template:
Ado.net entityobject generator
POCO object:ADO.NET POCO entity generator
(model not inheritance from entity object which related to entity framework run time)
and generate 2 tt fies
Model1.Context.tt
Model1.tt