can't select single property or related entity for ISessionTable

Aug 16, 2009 at 6:15 AM

NorthwindSession ns = new NorthwindSession(provider);
var list= ns.Orders.Select(o => o.OrderDate).ToList();

will raise error in DbEntitySessionBase:

private object OnEntityMaterialized(MappingEntity entity, object instance)

because entity is null, i changed to :

private object OnEntityMaterialized(MappingEntity entity, object instance)
        {
            if (entity == null)
                return instance;
            IEntitySessionTable table = (IEntitySessionTable)this.GetTable(entity);
            return table.OnEntityMaterialized(instance);
        }

it woks fine.