Looping through columns in Entity Framework
So I had a look and made a few modifications, see below with comments.

// Made the method generic, the constaint is required by DbSet
static void LoopThroughColumns&lt;T&gt;(Func&lt;someDbContext, DbSet&lt;T&gt;&gt; getTable)
    where T : class
{
    using (var db = new someDbContext())
    {
        // Selecting columns exlicitly was unnecessary
        var query = getTable(db);
        var columnAccessors = CreateAccessors&lt;T&gt;();

        foreach (var row in query)
        {
            foreach (var col in columnAccessors)
            {
                var val = col(row);
            }
        }
    }
}

// Parameter is unnecessary as you never used it
static Func&lt;T, object&gt;[] CreateAccessors&lt;T&gt;()
{
    // Index and Property values weren't being used
    // ToArray() was an unnecessary conversion
    var propertyAccessors = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public)
                .Where(p =&gt; p.CanRead)
                .Select((p, i) =&gt;  CreatePropertyAccessor&lt;T&gt;(p));

    return propertyAccessors.Select(e =&gt; e).ToArray();
}

static Func&lt;T, object&gt; CreatePropertyAccessor&lt;T&gt;(PropertyInfo prop)
{
    var param = Expression.Parameter(typeof(T), "input");
    var propertyAccess = Expression.Property(param, prop.GetGetMethod());
    var castAsObject = Expression.TypeAs(propertyAccess, typeof(object));
    var lambda = Expression.Lambda&lt;Func&lt;T, object&gt;&gt;(castAsObject, param);
    return lambda.Compile();
}


Usage is a little different now, you would call it like this:

LoopThroughColumns(e =&gt; e.someTable);


To be extra-super cool (ie. generic) you could even pass in an Action&lt;object&gt; and have that define what is done with val, then derive different methods on that one. Below I'm creating a PrintColumnValues method which calls LoopThroughColumns with an specific Action&lt;object&gt; to perform.

static void LoopThroughColumns&lt;T&gt;(Func&lt;someDbContext, DbSet&lt;T&gt;&gt; getTable, Action&lt;object&gt; actionOnObject)
    where T : class
{
    using (var db = new someDbContext())
    {
        var query = getTable(db);
        var columnAccessors = CreateAccessors&lt;T&gt;();

        foreach (var row in query)
        {
            foreach (var col in columnAccessors)
            {
                actionOnObject(col(row));
            }
        }
    }
}

static void PrintColumnValues&lt;T&gt;(Func&lt;someDbContext, DbSet&lt;T&gt;&gt; getTable)
    where T : class
{
    LoopThroughColumns(getTable, 
        new Action&lt;object&gt;(e =&gt; 
        {
            Console.WriteLine(e);
        }));
}


Usage

PrintColumnValues(e =&gt; e.someTable);