Lessons learned while trying to learn ORM mapping with LINQ in .NET.
- .NET 3.0: Several language extensions added needed for LINQ.
- .NET 3.5: LINQ to Objects, LINQ to XML and LINQ to SQL added. Unmapped relation between entity and a table possible. Table per Hierarchy inheritance possible.
- .NET 3.5 SP1: LINQ to Entities added. Mapped relation between entity and a table possible. Table per subclass and Table per Concrete class inheritance possible. A mapping layer is put between the entity classes and the physical tables.
For performance, capacity and physical location reasons entities with inheritance is storred in different ways. See picture.
Seen from the class view then the discriminator TypeVehicle is superfluous, since the relation to the parent is expressed through the inheritance declaration in the derived class.
When I become wiser then I might learn the best practice.
Code is in an assembly of same name.
Testing the “Dynamic Data Entity Web App” template
– Create a “Dynamic Data Entity Web App”
– Default.aspx – View in Browser => Error:
“There are no accessible tables. Make sure that at least one data model is registered in Global.asax and scaffolding is enabled or implement custom pages.”
OK, some mapping to some tables has to be done! How?
More to come…..