I found a LINQ to objects statement that now has changed after I've upgraded to Csla 3.5.2
For Some Reason this
var actionsForServiceWithDscr = (from ServiceActionReference serviceAction in _serviceActions.Where(c => c.SrvcTypeCd == serviceInfo.SrvcTypeCd)
from CodeDomainSystemValue action in _actions
where serviceAction.ActnTypeCd == action.CdValCd
select new { serviceAction.ActnTypeCd, action.LongDscr});
after the upgrade, started acting like it was missing the where Lambda expresion like below:
var actionsForServiceWithDscr = (from ServiceActionReference serviceAction in _serviceActions
from CodeDomainSystemValue action in _actions
where serviceAction.ActnTypeCd == action.CdValCd
select new { serviceAction.ActnTypeCd, action.LongDscr});
The change was simple enough
var actionsForServiceWithDscr = from ServiceActionReference serviceAction in _serviceActions
from CodeDomainSystemValue action in _actions
where serviceAction.ActnTypeCd == action.CdValCd && serviceAction.SrvcTypeCd == serviceInfo.SrvcTypeCd
select new { serviceAction.ActnTypeCd, action.LongDscr};
but I was wondering if anyone knew why?
CSLA 3.6 has its own LINQ to CSLA implementation for filtering so it "overrides" the default implementation from Microsoft. It may have been added in 3.5 and thus you see the new behavior.
If it is incorrect then you should note it as a possible bug.
Joe
Can you tell me what exception the former was giving you?
In either case, those are not cases we do any special handling on, other than passing control. I suppose one case might end up translating to something we don't handle well once it is desugared, which would lead me to being very interested in what exception is generated. But beyond that, given you are selecting something of a different type than what you are starting with, the standard L2O implementation should apply.
There is no exception generated. What is happening is that my lambda expression "_serviceActions.Where(c => c.SrvcTypeCd == serviceInfo.SrvcTypeCd)" is not being applied in the filter. I only want to join _serviceActions that had the same SrvcTypeCd as the serviceInfo.SrvcTypeCd. Instead I was getting all the _serviceActions.
So actionsForServiceWithDscr.Count() was always 500, rather than 0-20 depending on the SrvcTypeCd. Make sense?
Copyright (c) Marimer LLC