Good morning;
Is it possible to mark a property in an entity as computed? What i'm attempting to do is compose a query with expression trees and I need to query my DB based on the expression within a property; Preferably by way of writing the final SQL to represent the property (IE: [psudo](Where x & 1) >0)
Computed properties in queries
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Computed properties in queries
There is no such possibility.
Re: Computed properties in queries
Fortunately, I created a way to do it.
Re: Computed properties in queries
As a workaround, compute a column value at the database side (e.g.: via a trigger) and set Auto Generated Value=True, Auto-Sync=OnInsert for the corresponding property in the model.
Re: Computed properties in queries
Thank you.
I found a fairly robust way to accomplish the same goal is to inherit from the base entity and using auto-mapper, map individual "Calculated" fields while selecting the inherited DTO.
This accomplishes my goal of having the calculated fields aliased in the query so they can be accessible to down-stream predicates. Additionally, I don't have to change the schema; although I agree that would be the simplest solution.
I found a fairly robust way to accomplish the same goal is to inherit from the base entity and using auto-mapper, map individual "Calculated" fields while selecting the inherited DTO.
This accomplishes my goal of having the calculated fields aliased in the query so they can be accessible to down-stream predicates. Additionally, I don't have to change the schema; although I agree that would be the simplest solution.