Hello Brian,
Firstly I want to apologize for the inconvenience caused.
I have done the following changes in the
Context.ttinclude template in order to generate the stored procedure methods in the
IUnitOfWork interface:
- Modified the
GenerateContextInterface method to accept one additional parameter and added an additional method call to the
GenerateContextInterfaceMethods method in the
GenerateContextInterface;
- Defined a new method which generates the needed method definitions in the interface:
private
void
GenerateContextInterfaceMethods(Telerik.OpenAccess.CodeGeneration.CodeClass context)
{
System.Collections.Generic.IEnumerable<Telerik.OpenAccess.CodeGeneration.CodeFunction> functions = context.Functions;
PushIndent(
"\t"
);
functions.ForEach(
function =>
{
bool
generateRef=
false
;
if
(function.FunctionType == Telerik.Data.Dsl.DomainFunctionType.Void)
{
generateRef =
true
;
}
string
clrParametersDeclaration = GetClrParametersDeclarationForFunction(function, generateRef);
string
returnType = function.ReturnType;
if
(
string
.IsNullOrEmpty(returnType))
{
returnType =
"object"
;
}
string
methodToBeExecuted=
string
.Concat(
"this.ExecuteQuery<"
,returnType,
">"
);
string
resultType=
string
.Concat(
"IEnumerable<"
, returnType,
">"
);
if
(function.FunctionType == Telerik.Data.Dsl.DomainFunctionType.Void)
{
methodToBeExecuted =
"this.ExecuteNonQuery"
;
resultType =
"int"
;
}
else
if
(function.FunctionType == Telerik.Data.Dsl.DomainFunctionType.PrimitiveType)
{
methodToBeExecuted =
string
.Concat(
"this.ExecuteScalar<"
, returnType,
">"
);
resultType = function.ReturnType;
}
this
.WriteLine(
string
.Empty);
#>
<#=resultType#> <#= function.Name #>(<#= clrParametersDeclaration #>);
<#+
});
this
.PopIndent();
}
- Modified the
GenerateContextFileBlock to call the
GenerateContextInterface method by passing the context variable:
Hope that helps. If any other question arises, do not hesitate to contact us back.
Kind regards,
Damyan Bogoev
the Telerik team