Error on method directive

I have created a method directive with SalesOrder being the Service Name and Update being the method. In my directive I have some custom code and am looking up a record from the Customer table using the Customer Number for the sales order by the folowing code and then doing a GetByID().

var customerSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustomerSvcContract>(Db);
using (System.Transactions.TransactionScope txscope = IceDataContext.CreateDefaultTransactionScope())
{
var customer = customerSvc.GetByID(CustomerNumber);

In order to do this, I have to add a reference as shown

but when I enable the directive and try to save it I get the following stuff.

There is at least one compilation error.
CustomizationAdapter.cs(783,105): error CS0433: The type ‘ETCAddrValidationTableset’ exists in both ‘Erp.Contracts.BO.Customer, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.SalesOrder, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’
CustomizationAdapter.cs(788,108): error CS0433: The type ‘ETCAddrValidationTableset’ exists in both ‘Erp.Contracts.BO.Customer, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.SalesOrder, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’
CustomizationAdapter.cs(793,30): error CS0433: The type ‘ETCAddrValidationTableset’ exists in both ‘Erp.Contracts.BO.Customer, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’ and ‘Erp.Contracts.BO.SalesOrder, Version=11.3.100.0, Culture=neutral, PublicKeyToken=5d3fa3c7105d7992’
CustomizationAdapter.cs(9,142): error CS0738: ‘SalesOrderSvcCustomization’ does not implement interface member ‘SalesOrderSvcContract.ETCValidateAddress(bool, int, int, int, out bool, out bool, out string, out bool)’. ‘SalesOrderSvcCustomization.ETCValidateAddress(bool, int, int, int, out bool, out bool, out string, out bool)’ cannot implement ‘SalesOrderSvcContract.ETCValidateAddress(bool, int, int, int, out bool, out bool, out string, out bool)’ because it does not have the matching return type of ‘ETCAddrValidationTableset’.
CustomizationAdapter.cs(9,142): error CS0535: ‘SalesOrderSvcCustomization’ does not implement interface member ‘SalesOrderSvcContract.ETCAfterAddressValidationOTS(ref SalesOrderTableset, ETCAddrValidationTableset, int)’
CustomizationAdapter.cs(9,142): error CS0535: ‘SalesOrderSvcCustomization’ does not implement interface member ‘SalesOrderSvcContract.ETCAfterRelAddressValidationOTS(ref SalesOrderTableset, ETCAddrValidationTableset, int, int, int)’

Have any of you seen this and if so, how did you resolve it? If I remove the reference, I don’t get this error so it has something to do with that.

Yes, it is an annoying and long-standing bug that happens with some business objects.

Typically you get around it by moving your code to a Function, and then you call the Function from the Method Directive.

In your case though, do you really need to call the Customer BO? If you are just reading data you can do a linq query (Db.Customer) without adding the assembly reference. But if you need to update Customer then you will need the business objects and will have to try the Function approach.

1 Like

No, I don’t really need to call BO. I don’t know what exactly in your answer that sparked my thoughts but I went and built a BAQ passing in CustNum and getting the dat I want that way. I( call the BAQ from my directive now.Thank you for your insight.