Blog Home  Home Feed your aggregator (RSS 2.0)  
A Random Walk Around .Net - Data Access: LINQ to SQL & ADO.NET Entity Framework
 
 Tuesday, April 08, 2008

            At first glance these two new data access technologies seem to fulfill a common purpose.  Though, from my basic understanding the ADO.NET Entity Framework [EF] acts more like an Object Relational Mapping [ORM] tool, where as the LINQ to SQL [LTOS] acts similar to an ADO.NET Dataset.  This is my first observation and will most likely be discredited through further inspection.

            Functionally, we are trying to use a technology to extract, insert, modify and delete from our database.  Thus, it seems either technology would be well suited.  For a production system, we would lean towards LTOS because EF is still in a beta 3 version.  However, because we view this project as a learning exercise, we will employee both technologies.

            Due to the fact the EF is much more like an ORM; we will use it for our data access to the tables of the database.  Consequently, we will use LTOS for the data access associated with the views of the database.  Basically, the idea is if we change the underlying table structure, our business object to relational mapping should not have to change. 

In the above example, this should hold true (pending that EF does have a flexible Object to Relational Mapping portion).  We will leave this argument unjustified for the moment, because most likely we will have to change the database later on.

 

ADO.NET Entity Framework Table Map:

 

LINQ to SQL View Map:

Component:

SELECT     dbo.Castle.Name AS LookupName, dbo.Contracts.Namespace, dbo.Implementations.Id, dbo.Contracts.Interface AS ContractName, 
                      dbo.Implementations.Name AS ImplementationName, dbo.Components.InspectionBehavior, dbo.Components.Lifestyle, 
                      dbo.Components.CustomLifestyleType, dbo.Components.InitialPoolSize, dbo.Components.MaxPoolSize, dbo.Components.Id AS ComponentId, 
                      dbo.Contracts.Id AS ContractId
FROM         dbo.Castle INNER JOIN
                      dbo.Components ON dbo.Castle.Id = dbo.Components.CastleId INNER JOIN
                      dbo.Implementations ON dbo.Components.ImplementationId = dbo.Implementations.Id INNER JOIN
                      dbo.Contracts ON dbo.Implementations.ContractId = dbo.Contracts.Id

Parameter:

SELECT     dbo.Components.Id AS ComponentId, dbo.Contracts.Id AS ContractId, dbo.ContractParameters.Name AS ParmName, 
                      dbo.ContractParameters.DefaultValue AS ParmDefault, dbo.ComponentParameters.OverrideValue
FROM         dbo.Components INNER JOIN
                      dbo.Implementations ON dbo.Components.ImplementationId = dbo.Implementations.Id INNER JOIN
                      dbo.Contracts ON dbo.Implementations.ContractId = dbo.Contracts.Id INNER JOIN
                      dbo.ContractParameters ON dbo.Contracts.Id = dbo.ContractParameters.ContractId LEFT OUTER JOIN
                      dbo.ComponentParameters ON dbo.Components.Id = dbo.ComponentParameters.ComponentId AND 
                      dbo.ContractParameters.Id = dbo.ComponentParameters.ContractParameterId

 

Monday, April 07, 2008 11:03:53 PM (Central Standard Time, UTC-06:00)  #    Comments [0]    | 
Copyright © 2009 Yezdaan Baber. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: