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
|
Hi guys, I'm wanting to use a projection that includes fields from some related entities. The query executes fine, but I run into trouble when there are duplicates in the related field names. Is there any way to create an alias or otherwise define the mapping to the projection entity fields for the related fields?
I notice there is an overload of Projection.Add() that includes an Alias parameter, but I'm guessing that is for internal use rather than to support this scenario? Ideally, it would be great if LS detected when there were duplicate field names in the projection and mapped to a RelatedTable-prefixed column in the projection eg: Store.Number => StoreNumber while maintaining the status quo for non-duplicated fields eg: Customer.FirstName => FirstName. Less ideal, but still workable would be to offer an overload to Projection.Add() that allowed a manual definition of the fieldName to map to eg:
(In its current form this suggestion would clash with the existing (string,string) overload, but I'll leave you to work through the details :)) Thoughts/Suggestions? Thanks, Greg |
|
|
Hi Greg, Currently this is something we dont handle and we dont have any controls for manipulating the alias names that are applied to the columns in the query. I will have a look into how we can improve on this but I cant promise any changes in the near future as this is likely to be a bit of a time consuming one to tackle. The Alias parameter on that overload that you are seeing is for indicating the table alias associated with the field name rather than a column alias as you have found - this is used in conjunction with assigning table aliases on the query and is pretty much only used by our LINQ provider as far as Im aware :) In the meantime if you need to perform projections of this nature you will need to fall back on a stored procedure or FindBySql.
|
|