Core MVC v11.0
I have an entity with a file property, which the system puts in appbinaryobjects table.
When getting results, the created service goes and gets each binaryobject and then only uses the description. This is extremely slow.
So I'm doing this:
desc = _binaryObjectRepository.Get(id).Description;
This has helped - is there a better way to do this? I see there's a .Query on the IRepository - but I'm not sure how to use it.
Any faster way you might suggest?
I found the best way: desc = _binaryObjectRepository.Query<string>(q => q.Where(r => r.Id == id).Select(r => r.Description).FirstOrDefault());
In the above example, it still seleted all columns. The above generates a query similar to this (mysql):
select a.Descriptions from AppBinaryObjects as a where (false or (a.TenantId=5213)) AND (a.Id = '<guid>') limit 1