Eager Loading for Lazy Blobs

Is it possible to eager load lazy Blobs, like it's possible for Associations?

For normal, there is no need to load these Blobs immediatly. But there is one part, where I could load them directly without using a second SQL-Statement...

1 Like

That is unfortunately not possible yet.

would be a nice addition

I created this Feature Request
@Weetch_Russell just vote :wink:

2 Likes

I did the following as an efficient workaround:

// Getting Datas:
ObjManager.Find<TEntity>
  .Where(Linq['Active'] = True).List;

// Getting Blobs:
hBlobs := ObjManager.Find<TEntity>
    .Select(TProjections.ProjectionList
      .Add(Linq['Id'])
      .Add(Linq['BlobField'])
    .Where((Linq['Active'] = True) 
      and (Linq['BlobField'].IsNotNull)).ListValues;

  for hBlob in hBlobs do
  begin
    hEntity := ObjManager.Find<TEntity>(hBlob.Values[0]); // this uses the ObjManagers cache, so no SQL is fired...
    hEntity.BlobField:= hBlob.Values[1];
  end;

but this needs 2 selects and I have to check hEntity.BlobField.Available every time I want to only get the loaded Blobs...

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.