We've developed a DSL to help in coding Orchard custom modules. In the generated driver's Editor method, we're using partial methods to allow for the programmer to override the genrated code behavior, if needed.
At runtime, though, we're getting an exception that the partial method isn't implemented.
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
Additional information: 'MyModule.Drivers.CompanyPartDriver' does not contain a definition for 'CustomEditorGet'
According to the C# spec, it doesn't have to be, so I'm wondering if the dynamic compilation (or somesuch) is getting in the way here. Note that the code is manually compiled prior to run and debug, so there shouldn't be any code that needs compiled at runtime.
The bit in question is as follows:
public partial class CompanyPartDriver : ContentPartDriver<CompanyPart>
{
// other code
partial void CustomEditorGet(CompanyPart part, dynamic shapeHelper, ref DriverResult result);
protected override DriverResult Editor(CompanyPart part, dynamic shapeHelper)
{
DriverResult result;
if (AdminFilter.IsApplied(HttpContext.Current.Request.RequestContext))
result = ContentShape("Parts_CompanyAdmin_Edit",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/CompanyAdmin",
Model: part,
Prefix: Prefix));
else
result = ContentShape("Parts_Company_Edit",
() => shapeHelper.EditorTemplate(TemplateName: "Parts/Company",
Model: part,
Prefix: Prefix));
CustomEditorGet(part, shapeHelper, ref result);
return result;
}
// other code
}
Adding the "CustomEditorGet" method implementation in a partial class in another file, even if empty, all is fine. Just adding the partial class without the partial method impl doesn't fix it.
Any thoughts?