1. Used POCO Generator to create Function Imports
2. Had a Function that returns none
3. POCO Generator does not generate Functions that return none.
WUDDDAAAPPPAAAACCCKKERRRR
Alright, this was such a headache, but thanks to Matt Johnson in this stack overflow link:
http://stackoverflow.com/questions/3797248/update-function-import-not-displaying-in-context-file
...problem was solved.
Here is the Function Import region of the .tt file:
region.Begin("Function Imports");
foreach (EdmFunction edmFunction in container.FunctionImports)
{
var parameters = FunctionImportParameter.Create(edmFunction.Parameters, code, ef);
string paramList = String.Join(", ", parameters.Select(p => p.FunctionParameterType + " " + p.FunctionParameterName).ToArray());
string returnTypeElement = edmFunction.ReturnParameter == null
? null : code.Escape(ef.GetElementType(edmFunction.ReturnParameter.TypeUsage));
#>
<#=Accessibility.ForMethod(edmFunction)#> <#= returnTypeElement == null ? "int" : ("ObjectResult<" + returnTypeElement + ">") #> <#=code.Escape(edmFunction)#>(<#=paramList#>)
{
<#
foreach (var parameter in parameters)
{
if (!parameter.NeedsLocalVariable)
{
continue;
}
#>
ObjectParameter <#=parameter.LocalVariableName#>;
if (<#=parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null"#>)
{
<#=parameter.LocalVariableName#> = new ObjectParameter("<#=parameter.EsqlParameterName#>", <#=parameter.FunctionParameterName#>);
}
else
{
<#=parameter.LocalVariableName#> = new ObjectParameter("<#=parameter.EsqlParameterName#>", typeof(<#=parameter.RawClrTypeName#>));
}
<#
}
#>
return base.ExecuteFunction<#= returnTypeElement == null ? "" : ("<" + returnTypeElement + ">")#>("<#=edmFunction.Name#>"<#=code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()))#>);
}
<#
}
region.End();
No comments:
Post a Comment