Saturday, May 24, 2008
kick it on DotNetKicks.com

I have always built architectures on top of ADO.NET DataTables, they're fast (yes), flexible, and the power it provides is really pretty good. Additionally, as new features are added to ADO.NET they can then be easily absorbed. We were able to add LINQ to SQL to EntitySpaces by simply turning a LINQ query into an ADO.NET DataTable. Once we exchange the LINQ query for an ADO.NET DataTable the EntitySpaces architecture functions as normal since its underlying data structure is a DataTable. Pretty sweet. Here's a nice little trick in case you are not aware of it.

DataContext context = new DataContext("User ID=sa;Initial Catalog=ForeignKeyTest;Data Source=localhost;");

var linqQuery = context.GetTable<Employee>().Where(s => s.LastName != "Griffin")
    .OrderBy(s => s.LastName);

SqlCommand cmd = context.GetCommand(linqQuery) as SqlCommand;

DataTable dataTable = new DataTable();
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dataTable);

There you have it. A DataTable obtained from a LINQ query, easy as pie.  You can simply ask the DataContext for a Command object and then use the Command object in combination with a DataAdapter to fill a DataTable. This is exactly what EntitySpaces 2008 does under the covers. This is an excellent way for architectures to leverage the power of LINQ to SQL.

EntitySpaces

From mobile devices to large scale enterprise solutions in need of serious transaction support, EntitySpaces can meet your needs. Whether you’re writing an ASP.NET application with medium trust requirements, a Mono application, or a Windows.Forms application, the EntitySpaces architecture is there for you. EntitySpaces is provider independent, which means that you can run the same binary code against any of the supported databases. EntitySpaces is available in both C# and VB.NET. EntitySpaces uses no reflection, no XML files, and sports a tiny foot print of less than 200k. Pound for pound, EntitySpaces is one tough, dependable .NET architecture.

The EntitySpaces Team
--

EntitySpaces LLC
Persistence Layer and Business Objects for Microsoft .NET
http://www.entityspaces.net