Sorry that I was unclear.
I need to create a grid of projected costs for a given number of years and given inflation factors, and I am trying to avoid fetching the entire structure and duplicating it for each year in memory.
These projections will not and are not be stored in the db.
So.. to continue with with the securityUser example, securityUser contains UserName, SecurityUserId, Password, etc., but no year.
For the time being, we've created a table of Numbers (that I can add DateTime.Now.Year to get years) so that we can do a cross join between securityUsers and Numbers.
So what I want is:
userName1, amount1, 2009
userName2, amount2, 2009
userName1, amount3, 2010
userName2, amount4, 2010
where securityUser has:
userName1,...
userName2,...
and Numbers has:
1
2
I will be doing a custom projection to a DTO that contains the entity and a year field.
speaking of which... is there anything wrong with:
var query = from su in this._linqMetaData.SecurityUsers select new
{
securityUser = this._linqMetaData.SecurityUsers.FirstOrDefault(su2 => su.SecurityUserId == su2.SecurityUserId),
};
This seems like a hack to the rule that you cannot store or pass to functions range variables.
If there is a better way of accomplishing the cross join, I'm all ears.
Otherwise, is it possible to use dbFunctionCalls that return a table? The example in the doc returns a decimal.
Thanks again.