Monday, August 18, 2008

We thought we'd tell you about two nice enhancements to our DynamicQuery API. We added two new methods to the esDynamicQuery class, ExecuteScalar and ExecuteReader. These will be available in our next ES2008 maintenance release when it comes out.

ExecuteScalar:

This query simply fetches the total table count. Of course, I could have used a Where clause to reduce it to a certain set of records.

EmployeesQuery query = new EmployeesQuery();
query.es.CountAll = true;
int count = (int)query.ExecuteScalar();

ExecuteReader:

This query selects the FirstName and LastName columns where the LastName is like "Gri%" and then gets an IDataReader on the result set.

EmployeesQuery query = new EmployeesQuery();
query.Select(query.FirstName, query.LastName);
query.Where(query.LastName.Like("Gri%"));

using (IDataReader reader = query.ExecuteReader())
{
    while (reader.Read())
    {
        string s = reader.GetString(0);
    }
}

Notice that neither of these approaches is used to populate a collection or an entity. This is similar to the already existing Query.LoadDataTable() method.

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