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
|
I am struggling to find a solution to this. I have an entity "Scorable" from which some other entities inherit (using SingleTableInheritance). These objects are in a many to many relationship with each other ("ScorableInScorable" table having a column named "Order"). I have a stored procedure which retrieves all the objects from the database hierarchically using SQL Server's CTE. In addition to all columns in the Scorable table it also retrieves Order column of a ScorableInScorable many-to-many relation. Now, what would be the recommended way of fetching the records so I will be able to somehow get the value of "Order" column ? It can be anonymous type or an extra column in "Scorable" Entity (but not in database as it won't be used) ? I need the function to return different inherited types (discrimination works fine). So far I have the function:
What would be nice would be to have:
Any help most appreciated. Thanks. |
|
|
The way we handle procedure queries means that we expect to load a single entity so you would need a new entity which looked like a Scorable which had the additional columns included specifically for use in this query (e.g what is generated in the designer if you dragged the proc on) so unfortunately your options are a bit limited here - either you go with what you already have which will at least give you the derived versions of each Scorable based on the discriminator value or you load into a new entity type and then perform some manual mapping to extract the Scorable instance yourself.
|
|
|
Thanks Jeremy, are there any short term plans to implement semi-transient properties on objects? Such marked fields will be transient with one exception - field will be loaded when query contains a respective field (same naming rules and attributes as standard fields). Is it worth looking into LightSpeed code to do a quick implementation of such functionality ? |
|
|
We do have this notion already with named aggregates where you can control when a field is expected in the results of query via used of a named aggregate for the query (here is some detail in the docs about this: http://www.mindscapehq.com/documentation/lightspeed/Performance-and-Tuning/Controlling-How-Entity-Data-Loads). Further to this you could specify the field as load-only to avoid it ever being considered for persistance. That said however we dont support named aggregates with stored procedure queries and we are not planning on adding this in so unfortunately you are left with the options mentioned earlier.
|
|