3.0 Final - TRIAL, December 8th, 2010
Adapter, Mysql, Target Framework: LLBLGen Pro Runtime
Hi All,
I want to auto generate methods which will return entities by using unique constraint.
as follows by using custom class LLBLGenHelper:
DetailEntity e = LLBLGenHelper.Detail.GetDetailEntityByUCEmail ( "email@gmail.com" );
which will either return the entity or null if not exists.
To start, I see in the file entityIncludeAdapter.template the following code, which I have copied and pasted directly without modification into my custom template:
<[Foreach UniqueConstraint]>
public IPredicateExpression ConstructFilterForUC<[Foreach UniqueConstraintEntityField]><[EntityFieldName]><[NextForeach]>()
{
IPredicateExpression filter = new PredicateExpression();
<[Foreach UniqueConstraintEntityField]> filter.Add(new FieldCompareValuePredicate(this.Fields[(int)<[CurrentEntityName]>FieldIndex.<[EntityFieldName]>], null, ComparisonOperator.Equal));
<[NextForeach]> return filter;
}
When I copy + paste this into my custom template, the generated output does not seem to get generated correctly, the result is:
<[ForeachUniqueConstraint]>
public IPredicateExpression ConstructFilterForUC()
{
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldCompareValuePredicate(this.Fields[(int)DetailFieldIndex.], null, ComparisonOperator.Equal));
return filter;
}
Other code in my custom template is expanded fine, so the template configuration seems ok.
Any ideas ?
Many thanks.