<Environment Info>
Adpater pattern
LLBL Designer version 2.0.0.0
LLBLGen Pro .NET 2.0 ORM Support Classes 2.0.0.60904
.Net 2.0
VS.NET 2005
</Environment Info>
We are using Nested DBFuctionCall , something I like this :
entityFields.DefineField(ADC.SEM.DAL.HelperClasses.GoalPomPlacementMetricFields.SeCost, 1, "Cost", AggregateFunction.Sum);
entityFields.DefineField(ADC.SEM.DAL.HelperClasses.GoalPomPlacementMetricFields.Clicks, 2, AggregateFunction.Sum);
IExpression expCPC = new Expression(entityFields[1], ExOp.Div, entityFields[2]);
entityFields.DefineField(new EntityField2("expCPC", expCPC), 3);
entityFields.DefineField(new EntityField2("CPC", new DbFunctionCall("ROUND", new object[] { new DbFunctionCall("DECODE", new object[] { entityFields[2], 0, 0, entityFields[3] }), 2 })), 4);
And after doing all the required things for DynamicList while making call to FetchTypedList() we are getting "Object not set exception". I debbuged the code and found the problem and fix.
In
protected virtual void InsertPersistenceInfoObjects( IDbFunctionCall functionCall )
condition for Parameter == DBFunction is missing(recursive call is missing).
Modified method looks something like this ::
<Modified method>
protected virtual void InsertPersistenceInfoObjects( IDbFunctionCall functionCall )
{
if(functionCall==null)
{
return;
}
for( int i = 0; i < functionCall.FunctionParameters.Length; i++ )
{
if (functionCall.FunctionParameters[i].GetType() == typeof(DbFunctionCall))
InsertPersistenceInfoObjects((IDbFunctionCall)functionCall.FunctionParameters[i]);
else
{
IEntityField2 parameterAsField = functionCall.FunctionParameters[i] as IEntityField2;
if (parameterAsField != null)
{
functionCall.FieldPersistenceInfos[i] = GetFieldPersistenceInfo(parameterAsField);
}
}
}
}
</Modified Method>
Btw after this fix things work for me