This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, Consider the following entities:
How does one map the properties on Document such that it would return the equivalent properties on the "Blob"? For example, I'd expect the ContentType, ContentLength, SHA512Hash to populated when performing UnitOfWork.Query, UnitOfWork.Find, UnitOfWork.FindOne. Ideally I'd only like one SELECT statement to be sent to the database. However, I should not be able to set the values on the Document class (as these things are calculated when a blob is created the very first time). I don't use the designer. Thanks, Werner |
|
|
You cant map them in such a way that they would be loaded in when querying for that entity directly (an entity with properties spanning multiple tables) where only one SELECT statement would be generated. You could however look at eager loading BlobReference and have BlobReference eager load its Blob and then have the properties refer to the associated properties across those associations, this would keep it to one batch of statements. e.g.
|
|
|
I'm already doing that. Its possible for me to write an expression as follows, which gets the content type for a given document and it spans multiple tables.
So I am curious whether there is anything I can do to "assist" LightSpeed, perhaps by writing a query (or expression) which may result in a query similar than the one above, but include all the "derived" properties. Thanks, Werner |
|
|
Unfortunately not. In the Find and FindOne cases (when we are loading a whole entity rather than a projection) we are expecting to load the fields which are specified in the model and there is no way for loading a field from across an association in the model in the same manner that you specify them in the projection syntax above.
|
|